This page documents protocol details and server packets not covered elsewhere, useful for client developers.
When a client connects, the server sends a handshake packet before authentication:
{
"cmd": "handshake",
"val": {
"server": { ... }, // Server info from config.json
"limits": { ... }, // Message/content limits
"version": "1.1.0", // Server version
"validator_key": "originChats-<key>" // Used for Rotur validation
}
}- The client should use this to display server info and prepare for authentication.
- Client sends:
{ "cmd": "auth", "validator": "<token>" } - Server responds:
- On success:
{ "cmd": "auth_success", "val": "Authentication successful" } - On failure:
{ "cmd": "auth_error", "val": "<reason>" } - On success, also:
{ "cmd": "ready", "user": { ...user object... } }
- On success:
See Authentication for full details.
When a user connects, all clients receive:
{
"cmd": "user_connect",
"user": {
"username": "<username>",
"roles": [ ... ],
"color": "#RRGGBB" // Color of user's primary role, if set
}
}When a user disconnects, all clients receive:
{
"cmd": "user_disconnect",
"username": "<username>"
}The server sends periodic pings to keep the connection alive:
{ "cmd": "ping" }Clients do not need to respond, but should keep the connection open.
All errors are sent as:
{ "cmd": "error", "val": "<error message>", "src": "<command>" }See Error Handling for details on all possible errors.
If a user is rate limited, the server responds:
{ "cmd": "rate_limit", "length": <milliseconds> }- The client should wait the specified time before retrying.
When a user joins a voice channel:
{
"cmd": "voice_user_joined",
"channel": "<channel_name>",
"user": {
"id": "<user_id>",
"username": "<username>",
"peer_id": "...", // Only for channel participants
"muted": false
},
"global": true
}When a user leaves a voice channel:
{
"cmd": "voice_user_left",
"channel": "<channel_name>",
"username": "<username>",
"global": true
}When a user mutes/unmutes:
{
"cmd": "voice_user_updated",
"channel": "<channel_name>",
"user": {
"id": "<user_id>",
"username": "<username>",
"peer_id": "...", // Only for channel participants
"muted": true // or false
},
"global": true
}Some responses include "global": true, indicating the message should be broadcast to all connected clients. Examples:
message_new- When a new message is sentmessage_edit- When a message is editedmessage_delete- When a message is deletedtyping- When a user starts typingmessage_react_add/remove- When reactions are added/removed- Voice events (see above)
Clients should display these messages to all relevant users based on channel permissions.
- All packets have a
cmdfield indicating the command type. - Most responses include a
valor other data field. - Text and voice events use different formats (voice uses
typenotcmd) - See also the commands documentation for all supported commands.
For more details, see: