# SOLEC protocol specification * Payload can contain multiple numeric types or binary data in a single frame * Numeric types are big endian * Numeric types names are same as in [Go](https://go.dev/ref/spec#Numeric_types) * See [test payload](#Test) for an example of complex data structure ## Frame | Type | Description | |----------|----------------| | `uint8` | Payload type | | `uint16` | Payload length | | `[]any` | Payload | ## Data types ### Numeric types * `uint8` * `uint16` * `uint32` * `uint64` ### `binary` | Type | Description | |--------|----------------| | uint16 | Data length | | binary | Data | ### `string` UTF-8 encoded string encapsulated in `bianry` type. ### `time` [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) stored in `uint16`. Timezone is always UTC. # Payloads ## Payload prefixes | Type | Name | |------|--------------| | 0x01 | Handshake | | 0x02 | Ping | | 0x03 | Pong | | 0x04 | Message | | 0xFF | Test | ## Payload types ### Handshake | Type | Name | Description | |--------|---------------------|----------------------------------------------------------| | uint8 | ProtocolVersionMajor | Bumped if changes are incompatible with previous version | | uint8 | PrococolVersionMinor | Bumber if changes are backwards compatible | ### Ping Can be send by client or server. Receiver shoudl reply with `Pong`. ### Pong Reply to `ping`. | Type | Name | Description | |--------|------|-------------------------| | uint64 | Time | Set just before sending | ### Test Used for testing purposes. Can change at any time. | Type | Name | Description | |--------|-------|-------------| | uint8 | Num1 | | | time | Time1 | | | string | Str1 | | | uint16 | Num2 | | | binary | Bin1 | | | uint32 | Num3 | | | string | Str2 | | | uint64 | Num4 | |