summaryrefslogtreecommitdiffstats
path: root/PROTOCOL.md
blob: b481a0ebe7867368d49761c781e2de27b022ef03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# SOLEC protocol specification

## Data format

Everything is big endian. `text` is always null terminated UTF-8.
Every packet starts with `uint8` denoting type of the rest of remaining data.

## Event types

| Type | Name      |
|------|-----------|
| 0x01 | Handshake |
| 0x02 | Ping      |
| 0x03 | Pong      |
| 0x04 | Message   |
| 0xFF | Test      |

## Events

### Handshake

Sent after estabilishing TCP connection. First by the client and then by the server.
If one of the sides uses different protocol version connection should be aborted.

| Type  | Name | Description      |
|-------|------|------------------|
| uint8 | ver  | Protocol version |


### Ping

Empty.

### Pong

`time` field contains Unix timestamp generated just before sending the packet.
Timezone should always be UTC.

| Type   | Name | Description      |
|--------|------|------------------|
| uint64 | time | Unix timestamp   |

### Test

Event type reserved for testing. Does not have defined structure.