# general

Choose Local demo or connect to a WebSocket server.

💬
Your room is ready.
Open this file in another tab and use Local demo, or connect it to your WebSocket backend.

WebSocket protocol

Your server should accept JSON messages. The browser sends:

{"type":"join","room":"general","name":"Alex","clientId":"..."}

{"type":"message","room":"general","name":"Alex","text":"Hello","clientId":"...","id":"...","time":123}

{"type":"typing","room":"general","name":"Alex","active":true,"clientId":"..."}

The page accepts those same message types, plus:

{"type":"presence","room":"general","users":["Alex","Sam"]}

Hosting note

A static HTML file cannot itself host a shared database or WebSocket service. Serve this file over HTTPS and point it at a wss:// endpoint. A reverse proxy can expose your socket at /ws on the same domain.