RealtimeStore

inner class RealtimeStore

Shared key/value store synchronized across participants.

observe needs a joined room: called before the room is joined or while it is reconnecting it adds no observer and reports the reason through RoomEventListener.onError — see Room for the codes. setValue and getValue throw instead. stopObserving is local and always runs.

Functions

Link copied to clipboard
suspend fun getValue(key: String): String?

Reads the current value for the given key.

Link copied to clipboard
fun observe(key: String, listener: RealtimeStoreListener)

Watches a key and reports every change to listener. Registering the same listener for a key twice is ignored.

Link copied to clipboard
suspend fun setValue(key: String, value: String?)

Sets a value for the given key.

Link copied to clipboard

Stops delivering changes for the given key to listener.