Skip to main content
Module

x/supabase/mod.ts>RealtimeClient

An isomorphic Javascript client for Supabase.
Go to Latest
class RealtimeClient
Re-export
import { RealtimeClient } from "https://deno.land/x/supabase@1.3.1/mod.ts";

Constructors

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

Initializes the Socket

Properties

channels: RealtimeSubscription[]
conn: WebSocket | null
decode: Function
encode: Function
endPoint: string
optional
headers: { [key: string]: string; }
heartbeatIntervalMs: number
heartbeatTimer: ReturnType<setInterval> | undefined
logger: Function
longpollerTimeout: number
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
transport: any

Methods

private
_appendParams(url: string, params: { [key: string]: string; })
private
_onConnClose(event: any)
private
_onConnError(error: Event | ErrorEvent)
private
_onConnOpen()
channel(topic: string, chanParams?)

Connects the socket.

Returns the current state of the socket.

disconnect(code?: number, reason?: string): Promise<{ error: Error | null; data: boolean; }>

Disconnects the socket.

Returns the URL of the websocket.

Retuns true is the connection is open.

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

Logs the message. Override this.logger for specialized logging.

Return the next message ref, accounting for overflows

onClose(callback: Function)

Registers a callbacks for connection state change events.

onConnMessage(rawMessage: any)
onError(callback: Function)

Registers a callback for connection state change events.

onMessage(callback: Function)

Calls a function any time a message is received.

onOpen(callback: Function)

Registers a callback for connection state change event.

push(data: Message)
remove(channel: RealtimeSubscription)

Removes a subscription from the socket.