Realtime Store - JavaScript
The Realtime Store allows you to store, update, retrieve, and observe custom key-value data within a meeting — in real time. It acts as a shared data layer across all connected participants, ensuring synchronized states throughout the session.
This is particularly useful for collaborative or stateful meeting experiences such as:
- Pinned messages and flags
- Moderation data (e.g., blocked users)
- Collaborative notes or polls
This page uses the following asynchronous methods. Refer to their API reference for the errors each Promise may reject with, and handle these rejections appropriately based on your use case.
setValue()
The setValue() method is used to store or update data in the RealtimeStore. If a key already exists, it will be overwritten with the new value. Passing null as the value deletes the key.
Key Notes
- Supports string values only.
- Each key can store up to 1 KB of data.
- A maximum of 100 keys are allowed per session.
- Deletion is performed by setting the value to
null. - Throws an error if:
- The key or value is missing or not of type string.
- The request fails.
- The session exceeds the 100-key limit.
Parameters
-
key(string)
The unique key to store the data under. -
value(string | null)
The string value to be stored. Passnullto delete the key.
Returns
Promise<void>
Example
try {
await meeting.realtimeStore.setValue("Blocked_Students", "[Halima,Rajan]");
console.log("Data set successfully!");
} catch (error) {
console.error("Failed to set data:", error);
}
getValue()
The getValue() method retrieves the current value associated with a given key.
Key Notes
- Returns the current string value for the given key.
- Useful for fetching shared state when joining a meeting or reloading a view.
- Throws
FAILED_TO_GET_VALUEif the key has not been set or if the request fails.
Parameters
key(string) The key whose value you want to retrieve.
Returns
Promise<string>— The stored value for the given key.
Example
try {
const value = await meeting.realtimeStore.getValue("Blocked_Students");
console.log("Current value:", value);
} catch (error) {
console.error("Failed to get data:", error);
}
observe()
The observe() method subscribes to real-time updates for a given key. When the key’s value changes, the callback is automatically triggered for all connected participants.
Key Notes
- Returns an
observerIdwhich you can later use to stop observing. - The callback receives the new value and information about who updated it.
- Ideal for syncing live data like timers, shared notes, or agendas.
Parameters
-
key(string) The key to observe. -
callback(function) Function triggered on each update. Receives:value(string | null) → Updated value ornullif deletedupdatedBy(string) → ID of the participant who made the update
Returns
Promise<string>— Unique observer ID.
Example
try {
const observerId = await meeting.realtimeStore.observe(
"Blocked_Students",
(value, updatedBy) => {
console.log("Value updated:", value, "by", updatedBy);
}
);
} catch (error) {
console.error("Failed to observe key:", error);
}
stopObserving()
Stops receiving updates for a specific observer ID.
Key Notes
- Should be called when the listener is no longer needed (e.g., component unmount).
Parameters
observerId(string) The observer ID returned fromobserve().
Returns
Promise<void>
Example
try {
await meeting.realtimeStore.stopObserving(observerId);
console.log("Stopped observing successfully!");
} catch (error) {
console.error("Failed to stop observing:", error);
}
⚠️ Error Handling & Constraints
| Property | Description |
|---|---|
| Error Handling | All RealtimeStore methods throw directly; wrap them in try...catch. |
| Payload Size | Maximum 1 KB per key. |
| Supported Type | Only string values are supported. Use null to delete key. |
| Concurrency | The latest write overwrites previous values (last write wins) |
| Key Limit | A maximum of 100 keys are allowed in a single session. |
API Reference
The API references for all the methods utilized in this guide are provided below:
Got a Question? Ask us on discord

