Realtime

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:

typedescription
subscribeSubscribe to a channel. Payload: { channel, userId?, metadata?, lastMessageId? }
unsubscribeUnsubscribe from a channel. Payload: { channel }
publishPublish a message to a channel. Payload: { channel, type, data, userId?, metadata? } (max 4 KB)
presence_updateUpdate presence metadata. Payload: { channel, userId, metadata? }
pingKeepalive — refreshes presence TTL. Server replies with pong.

Server → Client message types:

typedescription
connectedSent immediately after handshake with { socketId, projectId, timestamp }
subscribedConfirms channel subscription
unsubscribedConfirms channel unsubscription
publishedConfirms message was stored and broadcast
messageIncoming message from any subscriber of the channel
presencePresence update — data.users contains the current user list
presence_updatedConfirms own presence update
pongResponse to ping
errorError 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.

get/api/realtime/websocket

Request

  • Base URL
    https://core.blink.new
  • URL
    https://core.blink.new/api/realtime/websocket
  • Auth
    none required

Query parameters

project_idstring required
Example:my-project-123

Project identifier — scopes all channels to this project

Changes

No recorded changes to this operation across all 1 revision of this API.