update documentation
This commit is contained in:
parent
b758ccb14c
commit
51f68df50e
1 changed files with 14 additions and 9 deletions
23
PROTOCOL.md
23
PROTOCOL.md
|
@ -1,22 +1,27 @@
|
||||||
This file documents the websocket /api/ws
|
This file documents the websocket /api/ws
|
||||||
|
|
||||||
## Format
|
## Message format
|
||||||
Packet id then arguments \
|
lways bytes! \
|
||||||
|
Packet id followed by arguments \
|
||||||
Some packets don't have arguments so send just the packet id \
|
Some packets don't have arguments so send just the packet id \
|
||||||
There can be multiple packets in one message, those with variable length arguments have to be terminated \
|
There can be multiple packets in one message, those with unknown amount of arguments have to be terminated \
|
||||||
Numbers are signed
|
All number types are signed
|
||||||
|
|
||||||
## Authentication
|
## Authentication
|
||||||
|
Unsurprisingly, tokens are used to authenticate.
|
||||||
|
|
||||||
The first message from the server is:
|
The first message from the server is:
|
||||||
- `0x6d 0x73`
|
- `0x6d 0x73`
|
||||||
|
|
||||||
The client should reply, in a single message:
|
The client replies with a single message:
|
||||||
1. `0xb6 0xc4`
|
1. `0xb6 0xc4`
|
||||||
2. client version (byte), right now it's 0
|
2. client version (byte), currently it's `0` and won't change until everything is complete
|
||||||
3. length of access key (byte)
|
3. length of access key (byte)
|
||||||
4. access key, decoded from base64
|
4. token (bytes), decoded from base64
|
||||||
|
|
||||||
Authentication complete, the server will send a disconnect if something's wrong, otherwise it will pong. \
|
Authentication complete. \
|
||||||
|
If something's wrong the server disconnects, see below for reason codes. \
|
||||||
|
Otherwise the client receives a pong. \
|
||||||
No commands are handled during this time
|
No commands are handled during this time
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
|
@ -33,7 +38,7 @@ No commands are handled during this time
|
||||||
| `0x00` | Pong | 1. long: unix millis | A response to ping, also sent by server on successful authentication |
|
| `0x00` | Pong | 1. long: unix millis | A response to ping, also sent by server on successful authentication |
|
||||||
|
|
||||||
## Disconnect reasons
|
## Disconnect reasons
|
||||||
On every disconnect there's a human-readable message the client should display
|
Alongside code, there's always a human-readable message which contains more specific information
|
||||||
|
|
||||||
| Code | Name | Notes |
|
| Code | Name | Notes |
|
||||||
|--------|--------------------|-------------------------------------------------|
|
|--------|--------------------|-------------------------------------------------|
|
||||||
|
|
Loading…
Reference in a new issue