Every message in zeronode is encrypted byte array, which contains information about sender node, receiver node, message data, event, etc...
is_internal | event_type | id_length | id | sender_length | sender id | receiver_length | receiver id | event_length | event | data | |
Type | bool | int8 | int8 | hex | int8 | utf-8 | int8 | utf-8 | int8 | utf-8 | JSON |
length (bytes) | 1 | 1 | 1 | id_length | 1 | sender_length | 1 | receiver_length | 1 | event_length | remaining |
- First byte of envelop is describing if message is zeronode's internal event or a custom event - 1 is internal event, 0 is custom event.
- Next 1 byte (Int8) is holding the information about envelop type - 1 is tick, 2 is request, 3 is response, 4 is error.
- Next bytes are defining the envelop id.
- First 1 byte is Int8 and it's value contains the length of bytes after it holding envelop id.
- Next length of bytes hold the id of envelop which is hex encoded.
- Next bytes are defining the sender node id.
- Frst 1 byte is Int8 and it's value contains the length of bytes after it holding sender id.
- Next length of bytes hold the id of sender node, which is utf-8 encoded.
- Next bytes are defining the receiver node id.
- Frst 1 byte is Int8 and it's value contains the length of bytes after it holding receiver id.
- Next length of bytes hold the id of receiver node, which is utf-8 encoded.
- Next bytes are defining the event name.
- Frst 1 byte is Int8 and it's value contains the length of bytes after it holding event name.
- Next length of bytes hold the event name in utf-8 encoded format.
- Remaining bytes are the message data in JSON stringified format.