Skip to main content
Version: 1.x.x

Realtime Store - Android

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

set()

The set() 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 is missing or empty.
    • The request fails.
    • The session exceeds the 100-key limit.

Parameters

  • key (String)
    The unique key to store the data under.

  • value (String?)
    The string value to be stored. Pass null to delete the key.

  • callback (RealtimeStoreCallback<String>)
    The callback will trigger onSuccess() or onError() with String type.

Example

  meeting.realtimeStore.set("YOUR_KEY", message, object : RealtimeStoreCallback<String> {
override fun onSuccess(value: String) {
Log.d("VideoSDK", "Value: $value")
}

override fun onError(error: String) {
Log.e("VideoSDK", "Error: $error")
}
})

get()

The get() 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 an error if the key is missing/empty or if the request fails.

Parameters

  • key (String)
    The key whose value you want to retrieve.

  • callback (RealtimeStoreCallback<String>)
    The callback will trigger onSuccess or onError with String type.

Example

meeting.realtimeStore.get("YOUR_KEY", object : RealtimeStoreCallback<String> {
override fun onSuccess(value: String) {
Log.d("VideoSDK", "Value: $value")
}

override fun onError(error: String) {
Log.e("VideoSDK", "Error: $error")
}
})

observe()

The observe() method subscribes to real-time updates for a given key. When the key’s value changes, a delegate method on your listener is automatically triggered for all connected participants.

Key Notes

  • You register a listener object that conforms to the RealtimeStoreListener protocol.
  • The delegate method 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 (RealtimeStoreListener<String>)
    The callback will trigger onValueChanged with String newValue and Participant who updated the value.

Example

val realtimeStoreListener = object : RealtimeStoreListener {
override fun onValueChanged(newValue: String, updatedBy: Participant?) {
Log.d("VideoSDK", "onValueChange: Received update from: ${updatedBy.displayName}")
Log.d("VideoSDK", "onValueChange: Received update from: ${updatedBy.id}")
Log.d("VideoSDK", "onValueChange: New Value -> $newValue")
}
}

meeting.realtimeStore.observe(KEY_CHAT_HISTORY, realtimeStoreListener!!)

stopObserving()

Stops receiving updates for a specific key and listener combination.

Key Notes

  • Should be called when the listener is no longer needed (e.g., when the view/ui controller is deallocated).

Parameters

  • key (String)
    The key you want to stop observing.

  • callback (RealtimeStoreListener<String>)
    The callback/listener will be removed from list of listeners

Example

meeting.realtimeStore.stopObserving("YOUR_KEY", realtimeStoreListener)

Error Handling & Constraints

PropertyDescription
Error HandlingAll errors will be handled in onError() callback.
Payload SizeMaximum 1 KB per key.
Supported TypeOnly String values are supported. Use null to delete key.
ConcurrencyThe latest write overwrites previous values (last write wins)
Key LimitA maximum of 100 keys are allowed in a single session.

Got a Question? Ask us on discord