Skip to main content

Function: createRealtime()

createRealtime(client, options?): FrappeRealtime

Defined in: packages/client/src/realtime/index.ts:100

Wraps a FrappeClient with a socket.io-client connection to the site's realtime server. Reconnection (with backoff) is delegated entirely to socket.io-client's own reconnection* options — this module does not reimplement backoff.

Parameters

client

FrappeClient

options?

RealtimeOptions = {}

Returns

FrappeRealtime

Stable

Example

const realtime = createRealtime(frappe)
const stop = realtime.subscribeDoc('ToDo', 'TD-0001', (event) => console.log(event))
// later
stop()
realtime.close()