summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbt <bt@rctt.net>2026-03-19 13:44:43 +0100
committerbt <bt@rctt.net>2026-03-19 13:48:33 +0100
commit5164d3114d039e4b21f3207502b47f6872de9491 (patch)
tree868b1bf3bbbd41a6a2cb70b9ba4fe14b6f08737a
parent54ddec67c477a6fd73b0f623258c0849ba695b88 (diff)
downloadsolec-5164d3114d039e4b21f3207502b47f6872de9491.tar.gz
solec-5164d3114d039e4b21f3207502b47f6872de9491.zip
Update PROTOCOL.md
-rw-r--r--PROTOCOL.md54
1 files changed, 46 insertions, 8 deletions
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