Skip to content

Latest commit

 

History

History
68 lines (65 loc) · 2.24 KB

ENVELOP.md

File metadata and controls

68 lines (65 loc) · 2.24 KB

About

Every message in zeronode is encrypted byte array, which contains information about sender node, receiver node, message data, event, etc...

Structure


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) 11 1 id_length 1 sender_length 1 receiver_length 1 event_length remaining



  1. 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.
  2. Next 1 byte (Int8) is holding the information about envelop type - 1 is tick, 2 is request, 3 is response, 4 is error.
  3. Next bytes are defining the envelop id.
    1. First 1 byte is Int8 and it's value contains the length of bytes after it holding envelop id.
    2. Next length of bytes hold the id of envelop which is hex encoded.
  4. Next bytes are defining the sender node id.
    1. Frst 1 byte is Int8 and it's value contains the length of bytes after it holding sender id.
    2. Next length of bytes hold the id of sender node, which is utf-8 encoded.
  5. Next bytes are defining the receiver node id.
    1. Frst 1 byte is Int8 and it's value contains the length of bytes after it holding receiver id.
    2. Next length of bytes hold the id of receiver node, which is utf-8 encoded.
  6. Next bytes are defining the event name.
    1. Frst 1 byte is Int8 and it's value contains the length of bytes after it holding event name.
    2. Next length of bytes hold the event name in utf-8 encoded format.
  7. Remaining bytes are the message data in JSON stringified format.