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, callCancel().

ADisconnectionHandler is associated with a specific location in the database, as they are obtained by callingDatabaseReference::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 toCancel().
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 toRemoveValue().
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 toSetValueAndPriority().
SetValueLastResult()
Future< void >
Get the result of the most recent call toSetValue().
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 ofUpdateChildren().

Public functions

Cancel

Future<void>Cancel()

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

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

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

CancelLastResult

Future<void>CancelLastResult()

Get the result of the most recent call toCancel().

Details
Returns
Result of the most recent call toCancel().

RemoveValue

Future<void>RemoveValue()

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

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

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

RemoveValueLastResult

Future<void>RemoveValueLastResult()

Get the result of the most recent call toRemoveValue().

Details
Returns
Result of the most recent call toRemoveValue().

SetValue

Future<void>SetValue(Variantvalue)

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

When theFuture 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 theVariant types are used, seefirebase::database::DatabaseReference::SetValue().
Returns
AFuture result, which will complete when the operation either succeeds or fails. When theFuture is completed, if its Error is kErrorNone, the operation succeeded.

SetValueAndPriority

Future<void>SetValueAndPriority(Variantvalue,Variantpriority)

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

When theFuture 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 theVariant types are used, seefirebase::database::DatabaseReference::SetValue().
priority
The priority to set this location to when the client disconnects. TheVariant types accepted are Null, Int64, Double, and String. For information about how priority is used, seefirebase::database::DatabaseReference::SetPriority().
Returns
AFuture result, which will complete when the operation either succeeds or fails. When theFuture is completed, if its Error is kErrorNone, the operation succeeded.

SetValueAndPriorityLastResult

Future<void>SetValueAndPriorityLastResult()

Get the result of the most recent call toSetValueAndPriority().

Details
Returns
Result of the most recent call toSetValueAndPriority().

SetValueLastResult

Future<void>SetValueLastResult()

Get the result of the most recent call toSetValue().

Details
Returns
Result of the most recent call toSetValue().

UpdateChildren

Future<void>UpdateChildren(Variantvalues)

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

When theFuture 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 anyVariant type. A value ofVariant type Null will delete the child.
Returns
AFuture result, which will complete when the operation either succeeds or fails. When theFuture is completed, if its Error is kErrorNone, the operation succeeded.

UpdateChildren

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

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

When theFuture 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
AFuture result, which will complete when the operation either succeeds or fails. When theFuture 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 ofUpdateChildren().

Details
Returns
Result of the most recent call toUpdateChildren().

~DisconnectionHandler

~DisconnectionHandler()

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-01-23 UTC.