Chat (WebSocket)
Session bootstrap
GET /chat/token
- Query:
matchId=<uuid>
Response
{ "wsUrl": "wss://chat...", "wsToken": "<short-lived-token>" }
Message shapes
| Direction | Event | Payload |
|---|---|---|
| Client → Server | join | { "matchId": "<uuid>" } |
| Client → Server | msg | { "text": "Hey adventurer!" } |
| Client → Server | typing | { "isTyping": true } |
| Server → Client | system | { "event": "joined" } |
| Server → Client | msg | { "id": "<uuid>", "from": "did:web:...", "text": "...", "ts": "2024-01-01T00:00:00Z" } |
| Server → Client | reveal | { "state": "pending", "by": "did:web:...", "media": { "url": "https://...", "kind": "clip" }? } |
Gate enforcement lives server-side: links/media are rejected until both players reach Chapter ≥ 3.