Chat flows
Public room, live:
GET /v1/chat/rooms(HTTP) to show the public rooms (key,name,member_count).- Open the WebSocket and authenticate (
auth→auth.ok). chat.join{"room":"world"}→RoomInfo(keep itsid).chat.history{"room":12,"limit":50}→ the latest messages (newest first: reverse for display).chat.send{"room":12,"text":"hello","nonce":"k3j9x"}→{"message_id":981,"sent_at":…}; then your ownchat.messagepush withid: 981arrives.- Show every
chat.messagepush for the room; remove messages onchat.deleted; update the online list onchat.presence(or askchat.members). - After a reconnect:
chat.joinagain, then load history newer than the last message you have (page withchat.historyuntil you reach a knownid).
Direct messages:
POST /v1/chat/dm{"user":77}→RoomInfowithkind: "dm",peer: 77(the same room every time for the same pair).chat.send{"room":<dm room id>,"text":"…"}: no join needed; both players receivechat.messageon every open connection.GET /v1/chat/dmslists the caller's DM rooms, newest activity first; history works as for any room.
Older history: pass the previous page's next_cursor as cursor (HTTP query or WebSocket
data) until next_cursor is absent. Messages are kept 30 days by default.
Moderation: DELETE /v1/chat/rooms/{room}/messages/{message} by the sender or a moderator; the
room gets chat.deleted. Editing: chat.edit (or PATCH on the same path) by the sender within
the edit window, or a moderator; the room gets chat.edited.
Unread counts and "seen":
- On opening a room, take the newest message's
idand sendchat.mark_read{"room":12,"message":<id>}(once per batch of messages, not for every message). - For badges,
chat.unread{"rooms":[12,13,…]}with the rooms on screen; after a reconnect ask again. - In DM, group and player rooms show the other members' markers from
chat.readpushes;chat.receipts{"room":12}gives the current ones (for example after a reconnect).
Typing: while the player types, chat.set_typing {"room":12,"typing":true} about every 3 s;
{"typing":false} when they stop or clear the input. Show others' chat.typing until
expires_in_ms passes or their message arrives.
A player's own room:
POST /v1/chat/rooms{"name":"Night Owls","visibility":"private"}→RoomInfo(role: "owner").POST /v1/chat/rooms/{room}/invites{"user":77}: the player getschat.roominvited(and achat.invitenotification with thenotificationsmodule);GET /v1/chat/rooms/minelists it withrole: "invited".- The invited player joins with
chat.join{"room":<id>}(orPOST /v1/chat/rooms/{room}/join) and chats as in any room;POST …/leavedeclines or leaves. - The owner:
PUT …/members/{user}/role{"role":"moderator"},DELETE …/members/{user}(a kick: banned until invited again),PATCH …to rename or open it,POST …/ownerto hand it on,DELETE …to delete it.
Do not resend chat.send automatically after a reconnect: it could post a message twice. If the
answer was lost, look for your nonce in the history first.
Generated from API.md (repository commit 84a9d3c, file sha256 e735542eb5f5).