RealtimeClient
§Constructors
Initializes the Socket.
The string WebSocket endpoint, ie, "ws://example.com/socket", "wss://example.com", "/socket" (inherited host & protocol)
The string HTTP endpoint, ie, "https://example.com", "/" (inherited host & protocol)
The Websocket Transport, for example WebSocket.
The default timeout in milliseconds to trigger push timeouts.
The optional params to pass when connecting.
The optional headers to pass when connecting.
The millisec interval to send a heartbeat message.
The optional function for specialized logging, ie: logger: (kind, msg, data) => { console.log(${kind}: ${msg}
, data) }
The function to encode outgoing messages. Defaults to JSON: (payload, callback) => callback(JSON.stringify(payload))
The function to decode incoming messages. Defaults to Serializer's decode.
he optional function that returns the millsec reconnect interval. Defaults to stepped backoff off.
Use Web Worker to set a side flow. Defaults to false.
The URL of the worker script. Defaults to https://realtime.supabase.com/worker.js that includes a heartbeat event call to keep the connection alive.
§Properties
§Methods
Disconnects the socket.
A numeric status code to send on disconnect.
A custom reason for the disconnect.
Returns the URL of the websocket.
string The URL of the websocket.
Returns all created channels
Logs the message.
For customized logging, this.logger
can be overridden.
Push out a message if the socket is connected.
If the socket is not connected, the message gets enqueued within a local buffer, and sent out when a connection is next established.
Unsubscribes and removes all channels
Unsubscribes and removes a single channel
A RealtimeChannel instance
Sets the JWT access token used for channel subscription authorization and Realtime RLS.
If param is null it will use the accessToken
callback function or the token set on the client.
On callback used, it will set the value of the token internal to the client.
A JWT string to override the token set on the client.