Connect to the native browser WebSocket server at /ws. Features room multiplexing, peer-to-peer event broadcasts, typing indicators, and an automated @bot assistant simulator without external socket dependencies.

Client establishes persistent ws:// or wss:// connection passing session identity.
Subscribe to rooms (#general, #support) with automated AI bot responses.
Server-Sent Events fallback for environments blocking persistent WebSocket frames.
The Playground WebSocket gateway parses standardized JSON envelope payloads:
| Frame Type | Direction | Payload Example | Description |
|---|---|---|---|
| join | Client → Server | {"type":"join","room":"general"} | Subscribes socket to a specific channel (e.g. general, support, custom). |
| chat | Client → Server | {"type":"chat","text":"Hello"} | Broadcasts a chat message to all peers in the current active room. |
| typing | Bidirectional | {"type":"typing","isTyping":true} | Emits keystroke typing bubble to room peers without persisting to database. |
| message | Server → Client | {"type":"message","id":"msg-..","text":".."} | Inbound server broadcast dispatched to subscribers with timestamp and sender ID. |
Production-grade integration patterns for Vanilla JS and React / Next.js hooks: