Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/blocks/deps.ts>supabase.RealtimeClient

deco is the edge-native site editor and app framework for building dynamic, high-performance sites with a built-in visual admin UI.
Go to Latest
class supabase.RealtimeClient
Re-export
import { supabase } from "https://deno.land/x/blocks@1.28.0-beta.4/deps.ts";
const { RealtimeClient } = supabase;

Constructors

new
RealtimeClient(endPoint: string, options?: RealtimeClientOptions)

Initializes the Socket.

Properties

accessToken: string | null
channels: RealtimeChannel[]
conn: WebSocket | null
decode: Function
encode: Function
endPoint: string
eventsPerSecondLimitMs: number
optional
headers: { [key: string]: string; }
heartbeatIntervalMs: number
heartbeatTimer: ReturnType<setInterval> | undefined
inThrottle: boolean
logger: Function
optional
params: { [key: string]: string; }
pendingHeartbeatRef: string | null
reconnectAfterMs: Function
reconnectTimer: Timer
ref: number
sendBuffer: Function[]
serializer: Serializer
stateChangeCallbacks: { open: Function[]; close: Function[]; error: Function[]; message: Function[]; }
timeout: number
transport: any

Methods

connect(): void

Connects the socket, unless already connected.

connectionState(): CONNECTION_STATE

Returns the current state of the socket.

disconnect(code?: number, reason?: string): void

Disconnects the socket.

Returns all created channels

isConnected(): boolean

Returns true is the connection is open.

log(
kind: string,
msg: string,
data?: any,
): void

Logs the message.

For customized logging, this.logger can be overridden.

push(data: RealtimeMessage): "rate limited" | void

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

setAuth(token: string | null): void

Sets the JWT access token used for channel subscription authorization and Realtime RLS.