Module frame

Module frame 

Source
Expand description

§Frame header

The unit of data exchanged over the network is called a Frame and consists of a 4-byte header and a body of variable size. The header has the following structure:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       |       |P|             |                               |
|Version|  Type |a|  Reserved   |        Payload length         |
|       |       |r|             |                               |
|       |       |t|             |                               |
+-------+-------+-+-------------+-------------------------------+

where

  • Version (4 bits)
  • Type (4 bits)
    • Data (0)
    • Ping (1)
    • Pong (2)
  • Partial (1 bit)
  • Reserved (7 bits)
  • Payload length (16 bits)

If the partial bit is set, the frame is only a part of the message and the read task will assemble all frames to produce the final message. The maximum total message size is capped to 5 MiB.

Structs§

Header
The header of a frame.
InvalidHeader

Enums§

Type
The type of a frame.