Skip to Content

Parse Request Packet

Request packet is used for invoke apis: send api request and get api response.

ℹ️Info

Packet type is 1

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| type=1|v|g|re.|    cmd_code   |           request_id          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |            timeout            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    body_len                   |               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
|                       body(by body_len)                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                        nonce(optional)                        +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                      signature(optional)                      +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Fields Descriptions:

FieldLength in bitLength in bytedescription
cmd_code81Command
request_id32(uint32)4Request id, it should be unique for one connection.
Can start from 1, when reach 4294967295 start over
timeout16(uint16)2timeout in millisecond
max: 60000(60s)
body_len24(uint32)3Then length of body in bytes.
Max: 16 MB
If gzip is enabled, the value is after compress
bodyVariable length, decide by body_lenvariable lengthbody,max size: 16 MB
nonce648exists when verify is 1
signature12816exists when verify is 1
ℹ️Info

Using specific protobuf defination to encode/decode body data