Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

RealtimePresence

class RealtimePresence {
constructor(channel: RealtimeChannel, opts?: PresenceOpts);
caller: {
onJoin: PresenceOnJoinCallback;
onLeave: PresenceOnLeaveCallback;
onSync: () => void;
}
;
channel: RealtimeChannel;
enabled: boolean;
joinRef: string | null;
pendingDiffs: RawPresenceDiff[];
}

§Constructors

§
new RealtimePresence(channel: RealtimeChannel, opts?: PresenceOpts)
[src]

Creates a Presence helper that keeps the local presence state in sync with the server.

@param channel
  • The realtime channel to bind to.
@param opts
  • Optional custom event names, e.g. { events: { state: 'state', diff: 'diff' } }.
@example
const presence = new RealtimePresence(channel)

channel.on('presence', ({ event, key }) => {
  console.log(`Presence ${event} on ${key}`)
})

§Properties

§
caller: {
onJoin: PresenceOnJoinCallback;
onLeave: PresenceOnLeaveCallback;
onSync: () => void;
}
[src]
§
enabled: boolean
[src]
§
joinRef: string | null
[src]
§
pendingDiffs: RawPresenceDiff[]
[src]