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.
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 e25edb9, file sha256 3db87f7bba70).