mirror of
https://github.com/longbridge/developers.git
synced 2026-09-19 03:34:09 +08:00
bff527753c
<img width="1159" alt="image" src="https://github.com/longportapp/openapi-website/assets/5518/6c5f5158-1d2b-48a1-b33d-304478703cd3">
1.2 KiB
1.2 KiB
title, id, slug, sidebar_position
| title | id | slug | sidebar_position |
|---|---|---|---|
| Parse Header of Packet | how-to-parse-header | /socket/protocol/header | 3 |
We have three type packet:
- request
- response
- push
The type of packet and some other info can decide the length of packet. Then length of Header is 1 byte.
:::info The length of Header is 1 byte. :::
Structure
0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+
| type |v|g|re.|
+-+-+-+-+-+-+-+-+
| Field | Length in bit | description |
|---|---|---|
| type | 4 | packet type:1 - request2 - resopnse3 - push |
| verify | 1 | if have signature data0 - Yes1 - No |
| gzip | 1 | if use gzip to compress data: 1 - Yes0 - No |
| reserve | 2 | reversed |
Example
// reserve - 0, gzip - 0, verify - 0, type - 1
0b 0000 0001
// reserve - 0, gzip - 1, verify - 0, type - 2
0b 0011 0010
// reserve - 0, gzip - 1, verify - 1, type - 3
0b 0001 0011
// reserve - 3, gzip - 1, verify - 0, type - 3
0b 1110 0011