Skip to main content
Module

x/live/deps.ts>supabase.RealtimeClient

Open-Source web editor based on Preact, Tailwind and TypeScript. The other side of code.
Very Popular
Go to Latest
class supabase.RealtimeClient
Re-export
import { supabase } from "https://deno.land/x/live@1.53.0/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.