Sometime you have to transmit binary data, like an image.
JSON (our main encoding scheme) does not support binary data.
What do we recommend?
Several options, which are all compatible with current LECO definitions:
- You can send the binary data in the first (and more) payload frame, while setting the message_type to some specific (TBD) value
- You can send a JSON message in the first payload frame and add the binary objects in additional payload frames.
This requires, however, that the code looks at the whole message and makes the additional frames available to the json-rpc interpreter somehow.
Here it might be good to define its own message type as well.
(I implemented this for PyMoDAQ)
- You can encode the binary data with some binary-to-text encoding to plain ASCII text, which can be sent via JSON.
The most common encoding seems to be base64.
All three approaches have their advantages and disadvantages.
I guess the choice depends on the circumstances.
Here I want to present them, maybe we can recommend one or the other, or even all three as
Sometime you have to transmit binary data, like an image.
JSON (our main encoding scheme) does not support binary data.
What do we recommend?
Several options, which are all compatible with current LECO definitions:
This requires, however, that the code looks at the whole message and makes the additional frames available to the json-rpc interpreter somehow.
Here it might be good to define its own message type as well.
(I implemented this for PyMoDAQ)
The most common encoding seems to be base64.
All three approaches have their advantages and disadvantages.
I guess the choice depends on the circumstances.
Here I want to present them, maybe we can recommend one or the other, or even all three as