WebSocket
Real-time messaging is delivered over Socket.IO. Operators and visitors connect to separate namespaces; the backend relays events through Redis pub/sub. If WebSocket is unavailable, the widget and panel fall back to HTTP polling (see Chat and Operators).
Connecting
Socket.IO path: /ws/ · URL: wss://vexar.chat/ws/
Operator namespace
Authenticate with a JWT in the query string (EventSource/Socket.IO query, since headers aren’t available).
const socket = io('https://vexar.chat/ws/', {
path: '/ws/',
query: { token: 'JWT_TOKEN' }
});
Visitor namespace
const socket = io('https://vexar.chat/ws/', {
path: '/ws/',
query: { siteKey: 'SITE_KEY', sessionId: 'SESSION_ID' }
});
Events & channels
The PHP backend publishes JSON to Redis; the Socket.IO server forwards it to the relevant room in real time:
| Redis channel | Delivered to |
|---|---|
ws:operator:{siteId} | Operators of the site |
ws:visitor:{convId} | The visitor of a conversation |
ws:visitor:proactive:{convId} | Proactive messages to a visitor |
Health check
GET https://vexar.chat/ws/health
→ { "status": "ok", "connections": { "operators": 5, "visitors": 42 } }