Playground/Realtime

RealtimeWebSocket channels & presence

realtime
Live channels with persistence and presence. One WS per channel.

Public lounge

Ready

Real WebSocket channel. Anyone visiting this page is in the same room as you. Messages persist (so you'll see scrollback); typing indicators don't. Be cool.

The actual flow

  1. 1
    Mint a short-lived WS token (server-side)
    POST /edge/realtime/token { user_id, name, ttl: 3600 }
  2. 2
    Open one WebSocket per channel
    wss://cohesivity.ai/edge/realtime?token=…&channel=playground:lounge
  3. 3
    Publish on the same socket
    { action: "publish", event: "message", data: {…} }For typing, add persist: false so it doesn't hit D1.
  4. 4
    Receive everything through the same socket
    Frames carry both action and event. Presence join/leave events fire automatically.