Specify that leaf-ultrapeer length is only two bytes

pull/4/head
Zlatin Balevsky 2018-07-04 23:54:22 +01:00
parent e10d8448ad
commit fe718e9be2
1 changed files with 6 additions and 2 deletions

View File

@ -12,9 +12,13 @@ All traffic after the handshake is compressed using the same compression algorit
## Messages
After the handhsake follows a stream of messages. Messages can arrive in any order. Each message consists of 3 bytes - the most significant bit of the first message indicates if the payload is binary or JSON. The remaining 23 bits indicate the length of the message.
After the handhsake follows a stream of messages. Messages can arrive in any order.
The JSON payload has two mandatory top-level fields - type and version:
Between ultrapeers, each message consists of 3 bytes - the most significant bit of the first byte indicates if the payload is binary or JSON. The remaining 23 bits indicate the length of the message.
Between leaf and ultrapeer, each message consists of 2 bytes unsigned payload length followed by the JSON payload.
The JSON structure has two mandatory top-level fields - type and version:
```
{