-
Notifications
You must be signed in to change notification settings - Fork 0
Server Protocol
This page describes the new Cryptodog server protocol.
All communication between a client and the server takes place over a secure WebSocket connection. Messages are serialized as JSON and prefixed with single character byte that identifies the type of the message.
Note that the end-to-end encryption protocol implemented by clients is not discussed here.
Join a specified room with a chosen nickname.
j{"room": "room name", "name": "nickname"}
Leave the room currently occupied by the client, but keep the connection alive. No JSON body required.
l
Send a message to the room.
g{"text": "message to send to room"}
Send a message to a specific occupant of the room.
p{"to": "recipient of private message", "text": "message to send to recipient"}
A user has joined the room.
j{"name": "nickname"}
A user has left the room.
l{"name": "nickname"}
Someone has sent a message to the room.
g{"from": "sender of group message", "text": "message contents"}
Someone in the room has sent a private message to the client.
p{"from": "sender of private message", "text": "message contents"}
Sent to the client upon joining a room to indicate which users are already present.
r{"users": ["nickname1", "nickname2", ...]}
The client did something wrong.
e{"error": "error message"}