Connection lifecycle
Handshake
Section titled “Handshake”The server sends this before accepting any command other than auth:
{ "cmd": "handshake", "val": { "server_time": 1760000000.125, "signing_url": "https://chat.example.com", "server": { "name": "Example", "icon": "…", "banner": "…", "url": "…", "owner": { "name": "sophie" } }, "limits": { "post_content": 2000, "search_results": 30, "max_reactions_per_message": 20, "max_members": 0 }, "uploads": { "emoji_allowed_file_types": [ "png" ], "sticker_allowed_file_types": [ "png" ], "uploads_per_minute": 10 }, "attachments": { "enabled": true, "max_size": 104857600, "allowed_types": [ "image/*" ], "max_attachments_per_user": -1, "permanent_tiers": [ "pro", "max" ] }, "version": "1", "validator_key": "originChats-…", "capabilities": [ "auth", "message_new", "…" ], "permissions": [ "manage_server", "manage_channels", "manage_users", "manage_roles", "manage_emojis", "manage_config", "review_reports", "view_audit_log" ] }}server_time and message timestamps are Unix seconds, including fractional seconds where available. Duration fields are command-specific; for example user_timeout.duration is seconds, while its emitted rate_limit.length is milliseconds.
Presence events
Section titled “Presence events”On first authentication, a new account produces user_join. When a user’s first active connection arrives, others receive user_connect. Multiple tabs share one online identity. Only after the last connection closes does the server emit user_disconnect and persist last_login.
Status changes are broadcast with cmd: "status_get". Becoming invisible sends user_disconnect to ordinary viewers; becoming visible again sends user_connect followed by status_get. Viewers with manage_users receive status_get with an additional invisible boolean.
Reconnection checklist
Section titled “Reconnection checklist”After reconnecting, obtain a new validator for the new handshake key. Do not reuse an old validator. Re-advertise client capabilities, request current channels and presence, then reconcile unread state. Live events missed while offline are not replayed automatically.
