Subscribe to a channel
GET
/v1/realtime/wsUpgrade WebSocket to realtime service. Messages are JSON objects discriminated by a type field — this is not the Phoenix protocol.
This English text was generated automatically from the French original and has not been reviewed yet.
#
Request
Settings
| Parameter | Type | Required | Description |
|---|---|---|---|
token | query | yes | User JWT, passed as a query parameter (a browser cannot set a header on a WebSocket). |
channel | query | no | Channel to join at connection. It must be prefixed with the project: {project_id}:{topic}. Otherwise, send a subscribe message after opening. |
vsn / format | query | no | Protocol version: 1.0.0 = JSON text (default), 2.0.0 = 6 byte binary header + JSON payload. |
config.postgres_changes[] | body (subscribe) | no | CDC filters: event (INSERT, UPDATE, DELETE or *, default *), schema, table, filter. On a channel not named db:<schema>.<table>, each filter needs a table. |
config.postgres_changes[].filter | string | no | Syntax colonne=op.valeur. Operators: eq, neq, lt, lte, gt, gte, in, like, optionally prefixed with not.. |
config.broadcast | object | no | self_broadcast (receive its own broadcasts, default false) and ack (acknowledgement of receipt, default false). |
config.presence | object | no | key — presence key allowing you to follow the same user on several tabs. |
config.private | boolean | no | Private channel: an authorization check is made before joining. |
#
Notes
Protocol messages
Info
Client → server: subscribe, unsubscribe, broadcast, presence_update, ping, access_token. Server → client: subscribed, event, pong, error, token_refreshed, broadcast_ack, presence_state, channel_recovered.
#
Notes
HSE Alternative
Astuce
GET /v1/realtime/sse provides unidirectional flow. Unlike WebSocket, requires an API key and infers the project from ?project_id= or the prefix of ?channel=.
#
Notes
RLS
Info
CDC events inherit RLS policies: a client is only notified of changes on lines it can read. The JWT is re-validated periodically (every 5 minutes at most) — send access_token to renew it without breaking the connection.
v1.0 · revised Apr 15, 2026