OnDisconnect

The OnDisconnect class is used to manage operations that will be run on the server when this client disconnects. It can be used to add or remove data based on a client's connection status. It is very useful in applications looking for 'presence' functionality.

Instances of this class are obtained by calling DatabaseReference.onDisconnect on a Firebase Database ref.

Properties

Link copied to clipboard
val OnDisconnect.android: OnDisconnect
val OnDisconnect.android: OnDisconnect
Link copied to clipboard
Link copied to clipboard
val OnDisconnect.ios: FIRDatabaseReference
Link copied to clipboard
val OnDisconnect.js: OnDisconnect

Functions

Link copied to clipboard
suspend fun cancel()

Cancel any disconnect operations that are queued up at this location

Link copied to clipboard
suspend fun removeValue()

Remove the value at this location when the client disconnects

Link copied to clipboard
inline suspend fun <T> setValue(value: T?, encodeDefaults: Boolean)
inline suspend fun <T> setValue(value: T?, buildSettings: EncodeSettings.Builder.() -> Unit = {})
suspend fun <T> setValue(strategy: SerializationStrategy<T>, value: T, encodeDefaults: Boolean)
inline suspend fun <T> setValue(strategy: SerializationStrategy<T>, value: T, buildSettings: EncodeSettings.Builder.() -> Unit = {})

Ensure the data at this location is set to the specified value when the client is disconnected (due to closing the browser, navigating to a new page, or network issues).

Link copied to clipboard
suspend fun updateChildren(update: Map<String, Any?>, encodeDefaults: Boolean)
inline suspend fun updateChildren(update: Map<String, Any?>, buildSettings: EncodeSettings.Builder.() -> Unit = {})

Ensure the data has the specified child values updated when the client is disconnected