Firebase.Database.OnDisconnect

The OnDisconnect class is used to manage operations that will be Run on the server when this client disconnects.

Summary

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 onDisconnect DatabaseReference.onDisconnect()

on a FirebaseDatabase ref.

Public functions

Cancel()
Task
Cancel any disconnect operations that are queued up at this location
RemoveValue()
Task
Remove the value at this location when the client disconnects
SetValue(object value)
Task
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).
SetValue(object value, string priority)
Task
Ensure the data at this location is set to the specified value and priority when the client is disconnected (due to closing the browser, navigating to a new page, or network issues).
SetValue(object value, double priority)
Task
Ensure the data at this location is set to the specified value and priority when the client is disconnected (due to closing the browser, navigating to a new page, or network issues).
UpdateChildren(IDictionary< string, object > update)
Task
Ensure the data has the specified child values updated when the client is disconnected

Public functions

Cancel

Task Cancel()

Cancel any disconnect operations that are queued up at this location

Details
Returns
The Task{TResult} for this operation.

RemoveValue

Task RemoveValue()

Remove the value at this location when the client disconnects

Details
Returns
The Task{TResult} for this operation.

SetValue

Task SetValue(
  object value
)

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).

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).

This method is especially useful for implementing "presence" systems, where a value should be changed or cleared when a user disconnects so that they appear "offline" to other users.

Details
Parameters
value
The value to be set when a disconnect occurs
Returns
The Task{TResult} for this operation.

SetValue

Task SetValue(
  object value,
  string priority
)

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

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

This method is especially useful for implementing "presence" systems, where a value should be changed or cleared when a user disconnects so that they appear "offline" to other users.

Details
Parameters
value
The value to be set when a disconnect occurs
priority
The priority to be set when a disconnect occurs
Returns
The Task{TResult} for this operation.

SetValue

Task SetValue(
  object value,
  double priority
)

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

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

This method is especially useful for implementing "presence" systems, where a value should be changed or cleared when a user disconnects so that they appear "offline" to other users.

Details
Parameters
value
The value to be set when a disconnect occurs
priority
The priority to be set when a disconnect occurs
Returns
The Task{TResult} for this operation.

UpdateChildren

Task UpdateChildren(
  IDictionary< string, object > update
)

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

Details
Parameters
update
The paths to update, along with their desired values
Returns
The Task{TResult} for this operation.