Package | com.myflashlab.air.extensions.firebase.db |
Class | public class DBWhenDisconnect |
Inheritance | DBWhenDisconnect flash.events.EventDispatcher |
The DBWhenDisconnect 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 whenDisconnect on a Firebase DBReference.
Method | Defined By | ||
---|---|---|---|
cancel():void Cancel any disconnect operations that are queued up at this location | DBWhenDisconnect | ||
removeValue():void Remove the value at this location when the client disconnects | DBWhenDisconnect | ||
setValue($value:*, $priority:String = null):void
Ensure the data at this location is set to the specified value when the client is disconnected
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. | DBWhenDisconnect | ||
updateChildren($childUpdates:Object):void
Ensure the data has the specified child values updated when the client is disconnected
| DBWhenDisconnect |
cancel | () | method |
public function cancel():void
Cancel any disconnect operations that are queued up at this location
removeValue | () | method |
public function removeValue():void
Remove the value at this location when the client disconnects
setValue | () | method |
public function setValue($value:*, $priority:String = null):void
Ensure the data at this location is set to the specified value when the client is disconnected
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.
Parameters
$value:* — The value to be set when a disconnect occurs
| |
$priority:String (default = null ) — The priority to be set when a disconnect occurs
|
updateChildren | () | method |
public function updateChildren($childUpdates:Object):void
Ensure the data has the specified child values updated when the client is disconnected
Parameters
$childUpdates:Object — The paths to update, along with their desired values
|