Connect via WebSocket
Establish a persistent WebSocket connection for real-time bi-directional messaging. The HTTP GET request is upgraded to the WebSocket protocol (RFC 6455).
Pass project_id as a query parameter. Connections without a valid project ID are closed with code 1008.
All frames are JSON-encoded with a type and payload field. After connecting, the server sends a connected message.
Client → Server message types:
| type | description |
|---|---|
| subscribe | Subscribe to a channel. Payload: { channel, userId?, metadata?, lastMessageId? } |
| unsubscribe | Unsubscribe from a channel. Payload: { channel } |
| publish | Publish a message to a channel. Payload: { channel, type, data, userId?, metadata? } (max 4 KB) |
| presence_update | Update presence metadata. Payload: { channel, userId, metadata? } |
| ping | Keepalive — refreshes presence TTL. Server replies with pong. |
Server → Client message types:
| type | description |
|---|---|
| connected | Sent immediately after handshake with { socketId, projectId, timestamp } |
| subscribed | Confirms channel subscription |
| unsubscribed | Confirms channel unsubscription |
| published | Confirms message was stored and broadcast |
| message | Incoming message from any subscriber of the channel |
| presence | Presence update — data.users contains the current user list |
| presence_updated | Confirms own presence update |
| pong | Response to ping |
| error | Error notification with { error, timestamp } |
Limits: Max 50 channels per connection. Data payload max 4 KB. High-frequency presence/stats/typing/cursor messages are coalesced over a 50 ms window; chat messages are always delivered in order.
Request
- Base URLhttps://core.blink.new
- URLhttps://core.blink.new/api/realtime/websocket
- Authnone required
Query parameters
Project identifier — scopes all channels to this project
Changes
No recorded changes to this operation across all 1 revision of this API.