Skip to main content
Module

x/supabase/mod.ts>RealtimeSubscription

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

Constructors

new
RealtimeSubscription(
topic: string,
params?: any,
)

Properties

bindings: any[]
joinedOnce: boolean
joinPush: Push
pushBuffer: Push[]
rejoinTimer: Timer
state
timeout: number

Methods

isMember(topic: string)
off(event: string)
on(event: string, callback: Function)
onClose(callback: Function)
onError(callback: Function)
onMessage(
_event: string,
payload: any,
_ref?: string,
)

Overridable message hook

Receives all events for specialized message handling before dispatching to the channel callbacks. Must return the payload, modified or unmodified.

push(
event: CHANNEL_EVENTS,
payload: any,
timeout?,
)
rejoin(timeout?)
replyEventName(ref: string)
sendJoin(timeout: number)
subscribe(timeout?)
trigger(
event: string,
payload?: any,
ref?: string,
)
unsubscribe(timeout?)

Leaves the channel

Unsubscribes from server events, and instructs channel to terminate on server. Triggers onClose() hooks.

To receive leave acknowledgements, use the a receive hook to bind to the server ack, ie: channel.unsubscribe().receive("ok", () => alert("left!") )