* Client sends initial Noise handshake message with his username, room
name and optional BLAKE2s-256 hash of the room's password (or an empty
- string) as a payload: ["USERNAME", "ROOM", BLAKE2s(PASSWORD)].
+ string) as a payload: [USERNAME, ROOM, hash(PASSWD)].
-* Server answers with final noise handshake message with the ["COOKIE",
- COOKIE], or ["ERR", MSG] failure message. It may reject a client if
- there are too many peers, its name is already taken or it provided an
- invalid room's password.
+* Server answers with final noise handshake message with the
+ ["COOKIE", COOKIE], or ["ERR", MSG] failure message. It may reject a
+ client if there are too many peers, its name is already taken or it
+ provided an invalid room's password.
* The 128-bit cookie is sent by client over UDP to the server every
second. If UDP packets are lost, then no connection is possible and
* client's UDP address knowledge (after passing NAT, its port may
differ from known to client one)
-* Server replies with ["SID", X], where X is single byte stream number
- client must use.
+* Server replies with ["SID", SID], where SID is single byte stream
+ number client must use.
* ["PING"] and ["PONG"] messages are then sent every ten seconds as a heartbeat.
-S <- C : e, es, NS(NS("USERNAME") || NS("ROOM") || NS("PASSWORD"))
-S -> C : e, ee, NS(NS("COOKIE") || NS(COOKIE))
-S <- C : UDP(COOKIE)
-S -> C : NS(NS("SID") || NS(X))
+ S <- C : e, es, NS(NS(USERNAME) || NS(ROOM) || NS(hash(PASSWD)))
+ S -> C : e, ee, NS(NS("COOKIE") || NS(COOKIE))
+ S <- C : UDP(COOKIE)
+ S -> C : NS(NS("SID") || NS(SID))
-S <- C : NS(NS("PING"))
-S -> C : NS(NS("PONG"))
-S <> C : ...
-
-S -> C : NS(NS("ADD") || NS(SID) || NS(USERNAME) || NS(KEY))
-S -> C : ...
-
-S -> C : NS(NS("DEL") || NS(SID))
-S -> C : ...
+ S <- C : NS(NS("PING"))
+ S -> C : NS(NS("PONG"))
+ S <> C : ...
Every second the client sends UDP packet with his single-byte stream
identifier, even if it's muted. That may help punching holes in stateful
Clients are notified about new peers appearance with "ADD" commands,
telling their SIDs, usernames and keys. "DEL" notifies about leaving
-peers. "MUTED", "UNMUTED" notifies peer's mute toggling. "CHAT"
-broadcasts the message in the room.
+peers.
+
+ S -> C : NS(NS("ADD") || NS(SID) || NS(USERNAME) || NS(KEY))
+ S -> C : ...
+
+ S -> C : NS(NS("DEL") || NS(SID))
+ S -> C : ...
+
+"MUTED", "UNMUTED" notifies peer's mute toggling:
+
+ S <- C : NS(NS("[UN]MUTED"))
+ S -> C*: NS(NS("[UN]MUTED"), NS(SID))
+
+"CHAT" broadcasts the message in the room:
+
+ S <- C : NS(NS("CHAT"), NS(MSG))
+ S -> C*: NS(NS("CHAT"), NS(SID), NS(MSG))