observe

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.

The first listener for a key subscribes to it in the background, so a change made before that completes is not reported. A failed subscription goes to RoomEventListener.onError, with 4085 when the server refuses it.

Parameters

key

the key to watch

listener

receives the new value on each change

Throws