Skip to main content

Real-time Data Engine

The Real-time Data Engine is a component of the SDK that allows you to synchronize states between participants in a room. This enables various functionalities such as real-time data sharing, and event-driven communication for seamless collaborative experiences.

How SuperViz SDK uses it

SuperViz SDK uses the Real-time Data Engine to ensure its components have participant data synchronized between them. For a complete list of events dispatched by the SDK, regardless of the component you are using, please refer to our event documentation.

However, please note that events can be in a component context, and not always available for the room. They must be subscribed to through the respective component, such as the Video Conference. For those events, please refer to the documentation of the specific component for more details on how to subscribe and handle them.

Here are some examples of events related to rooms and components:

  • The room-related events, like the ParticipantEvent.LEFT that occurs when a participant leaves the room.
  • Components-related events, like the MeetingEvent.MEETING_PARTICIPANT_AMOUNT_UPDATE that occur when the number of participants in the meeting changes.

Before we start

Before utilizing the Real-time Data Engine component, it is essential to initialize a room with a defined name and ID for the participant and the group.

How to use

To use the Real-time Data Engine on your application, use the following code:

import { Realtime } from "@superviz/sdk";

const realtime = new Realtime();


After initializing it, you can the connect method to connect to a specific event channel.



The connect method allows you to connect to a specific event channel. If the channel does not exist, it will be created.

const channel = realTime.connect("<EVENT_NAME>");


The subscribe method allows you to listen to the Real-time Data Engine's events.

realTime.subscribe('', onCallbackFunction);

function onCallbackFunction(state) {
// do something


The Real-time emits one event that allows you to monitor and respond to its changes within the room in real-time.


The REALTIME_STATE_CHANGED is dispatched when there is a change under the current state of the Real-time Data Engine.

Here is an implementation on how to catch the dispatched event:

room.subscribe('realtime-component.state-changed', onRealTimeEngineStateChanged);

function onRealTimeEngineStateChanged(state) {
// do something

On the callback function, you will receive the following argument:

RealtimeComponentStateThe Real-time Data Engine current state. It can be STARTED or STOPPED.

Types Definitions


Type: enum

The enumerable represents the Real-time Data Engine's current state. These are the possible values: