WebSocket
Zlikord uses WebSocket for real-time messaging, presence, and voice signaling.
Connecting
Section titled “Connecting”WS /api/ws?token=<jwt_token>Pass your JWT token as the token query parameter. On successful connection, you will receive a READY event:
{ "type": "READY" }Client Commands (op)
Section titled “Client Commands (op)”Send JSON messages to the server with an op field.
SUBSCRIBE
Section titled “SUBSCRIBE”Subscribe to events for a room (channel or DM thread).
{ "op": "SUBSCRIBE", "room": "channel:42"}Room format:
channel:<id>— a guild text or voice channeldm:<id>— a direct message thread
Response:
{ "type": "SUBSCRIBED", "room": "channel:42" }If you lack access:
{ "type": "ERROR", "data": "forbidden room" }UNSUBSCRIBE
Section titled “UNSUBSCRIBE”{ "op": "UNSUBSCRIBE", "room": "channel:42"}Response:
{ "type": "UNSUBSCRIBED", "room": "channel:42" }VOICE_SIGNAL
Section titled “VOICE_SIGNAL”Forward a WebRTC signaling payload to other users in a voice channel.
{ "op": "VOICE_SIGNAL", "room": "channel:5", "data": { "type": "offer", "sdp": "..." }}The server broadcasts a VOICE_SIGNAL event to all other clients in the room, tagged with the sender’s user ID.
Server Events (type)
Section titled “Server Events (type)”Events are broadcast by the server to subscribed clients.
MESSAGE_CREATE
Section titled “MESSAGE_CREATE”A new message was sent in a subscribed channel.
{ "type": "MESSAGE_CREATE", "room": "channel:42", "data": { "id": 101, "channel_id": 42, "author_id": 1, "content": "Hello!", "created_at": "2026-01-15T12:01:00Z" }}DIRECT_MESSAGE_CREATE
Section titled “DIRECT_MESSAGE_CREATE”A new direct message was received.
{ "type": "DIRECT_MESSAGE_CREATE", "data": { "id": 51, "direct_thread_id": 1, "author_id": 2, "content": "Hey!", "created_at": "2026-01-15T12:01:00Z" }}VOICE_SIGNAL
Section titled “VOICE_SIGNAL”A WebRTC signaling message from another user.
{ "type": "VOICE_SIGNAL", "room": "channel:5", "data": { "from_user_id": 2, "signal": { "type": "answer", "sdp": "..." } }}VOICE_STATE_UPDATE
Section titled “VOICE_STATE_UPDATE”A user’s voice state changed (joined/left a voice channel).
{ "type": "VOICE_STATE_UPDATE", "room": "channel:5", "data": { "channel_id": 5, "joined": true, "member_user_ids": [1, 2], "member_states": [ { "user_id": 1, "muted": false, "deafened": false } ] }}An error occurred processing a command.
{ "type": "ERROR", "data": "unknown op" }