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

x/deco/deps.ts>supabase.RealtimeClient

Git-based Visual CMS for Deno, </> htmx and Tailwind apps. Deploy on any Deno-compatible host.
Go to Latest
class supabase.RealtimeClient
Re-export
import { supabase } from "https://deno.land/x/deco@1.75.1/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
fetch: Fetch
optional
headers: { [key: string]: string; }
heartbeatIntervalMs: number
heartbeatTimer: ReturnType<setInterval> | undefined
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): 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.