firebase::database::DisconnectionHandler

#include <disconnection.h>

Allows you to register server-side actions to occur when the client disconnects.

Summary

Each method you call (with the exception of Cancel) will queue up an action on the data that will be performed by the server in the event the client disconnects. To reset this queue, call Cancel().

A DisconnectionHandler is associated with a specific location in the database, as they are obtained by calling DatabaseReference::OnDisconnect().

Constructors and Destructors

~DisconnectionHandler()

Public functions

Cancel()
Future< void >
Cancel any Disconnection operations that are queued up by this handler.
CancelLastResult()
Future< void >
Get the result of the most recent call to Cancel().
RemoveValue()
Future< void >
Remove the value at the current location when the client disconnects.
RemoveValueLastResult()
Future< void >
Get the result of the most recent call to RemoveValue().
SetValue(Variant value)
Future< void >
Set the value of the data at the current location when the client disconnects.
SetValueAndPriority(Variant value, Variant priority)
Future< void >
Set the value and priority of the data at the current location when the client disconnects.
SetValueAndPriorityLastResult()
Future< void >
Get the result of the most recent call to SetValueAndPriority().
SetValueLastResult()
Future< void >
Get the result of the most recent call to SetValue().
UpdateChildren(Variant values)
Future< void >
Updates the specified child keys to the given values when the client disconnects.
UpdateChildren(const std::map< std::string, Variant > & values)
Future< void >
Updates the specified child keys to the given values when the client disconnects.
UpdateChildrenLastResult()
Future< void >
Gets the result of the most recent call to either version of UpdateChildren().

Public functions

Cancel

Future< void > Cancel()

Cancel any Disconnection operations that are queued up by this handler.

When the Future returns, if its Error is kErrorNone, the queue has been cleared on the server.

Details
Returns
A Future result, which will complete when the operation either succeeds or fails. When the Future is completed, if its Error is kErrorNone, the operation succeeded.

CancelLastResult

Future< void > CancelLastResult()

Get the result of the most recent call to Cancel().

Details
Returns
Result of the most recent call to Cancel().

RemoveValue

Future< void > RemoveValue()

Remove the value at the current location when the client disconnects.

When the Future returns, if its Error is kErrorNone, the RemoveValue operation has been successfully queued up on the server.

Details
Returns
A Future result, which will complete when the operation either succeeds or fails. When the Future is completed, if its Error is kErrorNone, the operation succeeded.

RemoveValueLastResult

Future< void > RemoveValueLastResult()

Get the result of the most recent call to RemoveValue().

Details
Returns
Result of the most recent call to RemoveValue().

SetValue

Future< void > SetValue(
  Variant value
)

Set the value of the data at the current location when the client disconnects.

When the Future returns, if its Error is kErrorNone, the SetValue operation has been successfully queued up on the server.

Details
Parameters
value
The value to set this location to when the client disconnects. For information on how the Variant types are used, see firebase::database::DatabaseReference::SetValue().
Returns
A Future result, which will complete when the operation either succeeds or fails. When the Future is completed, if its Error is kErrorNone, the operation succeeded.

SetValueAndPriority

Future< void > SetValueAndPriority(
  Variant value,
  Variant priority
)

Set the value and priority of the data at the current location when the client disconnects.

When the Future returns, if its Error is kErrorNone, the SetValue operation has been successfully queued up on the server.

Details
Parameters
value
The value to set this location to when the client disconnects. For information on how the Variant types are used, see firebase::database::DatabaseReference::SetValue().
priority
The priority to set this location to when the client disconnects. The Variant types accepted are Null, Int64, Double, and String. For information about how priority is used, see firebase::database::DatabaseReference::SetPriority().
Returns
A Future result, which will complete when the operation either succeeds or fails. When the Future is completed, if its Error is kErrorNone, the operation succeeded.

SetValueAndPriorityLastResult

Future< void > SetValueAndPriorityLastResult()

Get the result of the most recent call to SetValueAndPriority().

Details
Returns
Result of the most recent call to SetValueAndPriority().

SetValueLastResult

Future< void > SetValueLastResult()

Get the result of the most recent call to SetValue().

Details
Returns
Result of the most recent call to SetValue().

UpdateChildren

Future< void > UpdateChildren(
  Variant values
)

Updates the specified child keys to the given values when the client disconnects.

When the Future returns, if its Error is kErrorNone, the UpdateChildren operation has been successfully queued up by the server.

Details
Parameters
values
A variant of type Map. The keys are the paths to update and must be of type String (or Int64/Double which are converted to String). The values can be any Variant type. A value of Variant type Null will delete the child.
Returns
A Future result, which will complete when the operation either succeeds or fails. When the Future is completed, if its Error is kErrorNone, the operation succeeded.

UpdateChildren

Future< void > UpdateChildren(
  const std::map< std::string, Variant > & values
)

Updates the specified child keys to the given values when the client disconnects.

When the Future returns, if its Error is kErrorNone, the UpdateChildren operation has been successfully queued up by the server.

Details
Parameters
values
The paths to update, and their new child values. A value of type Null will delete that particular child.
Returns
A Future result, which will complete when the operation either succeeds or fails. When the Future is completed, if its Error is kErrorNone, the operation succeeded.

UpdateChildrenLastResult

Future< void > UpdateChildrenLastResult()

Gets the result of the most recent call to either version of UpdateChildren().

Details
Returns
Result of the most recent call to UpdateChildren().

~DisconnectionHandler

 ~DisconnectionHandler()