This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk/realtime / createRealtime

createRealtime() ​

createRealtime(client): Realtime

Gets the realtime of a client: always the same instance for the same client (the memoization lives in the client's registry, so it holds even across the ESM and CJS copies of the SDK). It does not open a connection: it opens on the first subscribe. After client.dispose(), the connection closes and subscribe throws CONFIGURATION_ERROR.

Parameters ​

client ​

EnginexClient

The client returned by createEnginexClient (the same object, not a copy). The object of a product package (createIgaming(enginex), createPredictions(enginex)) does not work: pass enginex itself.

Returns ​

Realtime

Example ​

ts
import { createRealtime } from '@getenginex/sdk/realtime'

const realtime = createRealtime(enginex)
realtime.onStatus((status) => console.log('realtime', status))

Throws ​

CONFIGURATION_ERROR if client is not a client created by createEnginexClient (e.g. a { ...client } copy) or comes from an incompatible version of the core. Identify it with isEnginexError(error, 'CONFIGURATION_ERROR').