From 5164d3114d039e4b21f3207502b47f6872de9491 Mon Sep 17 00:00:00 2001 From: bt Date: Thu, 19 Mar 2026 13:44:43 +0100 Subject: Update PROTOCOL.md --- PROTOCOL.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'PROTOCOL.md') diff --git a/PROTOCOL.md b/PROTOCOL.md index 886161c..b6d249e 100644 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -36,14 +36,52 @@ All payload types are described in following files: * [Kaitai Struct](https://git.sr.ht/~rctt/solec/blob/main/solec.ksy) * [SVG graph](https://git.sr.ht/~rctt/solec/blob/main/solec.svg) -### Payload types +## Client-server connection initialization -| Type | Name | -|------|--------------| -| 0x01 | Handshake | -| 0x02 | Ping | -| 0x03 | Pong | -| 0x04 | Message | -| 0xFF | Test | +1. Initialize TCP connection +2. Receive `handshake` +3. Send `hadnshake` +4. Send `auth` +5. Receive `success` or `error` +## Client-server messaging +After successfull auth server will listen for payloads of `message` type. +Sending different payload will result in error and connection will be closed +by the server. + +Message consist of following fields: +* Source - address of the user sending a message +* Target - address of channel or user receiving a message +* Timestamp - set by user sending a message, UTC timezone +* Content - UTF-8 string + +## Addresses + +Source and target addresses are similair to e-mail addresses. There are two +parts separated by `@` where second part is address of the server where +specific user or channel is registered on. + +Target addresses is set to user that created specific message. Messaegs can be +relayed between servers so it's necessary to keep that info as part of the +message. + +Channel addresses always starts from `#` to distinct them from user addresses. +Because of that user address cannot start from this character. + +Channels can be grouped in a hierarchy. Levels of channels hierarchy are +separated by `.`. + +`*` is special address reserved for broadcast messages send by the server +administrator. + +| Type | Address | +|-----------|----------------------| +| user | user@example.org | +| channel | #channel@example.org | +| broadcast | *@example.org | + +## Channels hierarchy + +Channels can be groupped into a hierarchy. Channels hierarchy can be used to +simplify moderation and management. \ No newline at end of file -- cgit v1.2.3