---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk/realtime/functions/createRealtime.md
---
[Reference](../../../../index.md) / [@getenginex/sdk/realtime](../index.md) / createRealtime

# createRealtime()

> **createRealtime**(`client`): [`Realtime`](../interfaces/Realtime.md)

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`](../../interfaces/EnginexClient.md)

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`](../interfaces/Realtime.md)

## 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')`.
