| java.lang.Object | |
| ↳ | com.google.firebase.database.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 onDisconnect on a Firebase Database ref.
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Task<Void> |
cancel()
This method is deprecated.
Use
cancelAsync().
| ||||||||||
| void |
cancel(DatabaseReference.CompletionListener listener)
Cancel any disconnect operations that are queued up at this location
| ||||||||||
| ApiFuture<Void> |
cancelAsync()
Cancel any disconnect operations that are queued up at this location
| ||||||||||
| Task<Void> |
removeValue()
This method is deprecated.
Use
removeValueAsync()
| ||||||||||
| void |
removeValue(DatabaseReference.CompletionListener listener)
Remove the value at this location when the client disconnects
| ||||||||||
| ApiFuture<Void> |
removeValueAsync()
Remove the value at this location when the client disconnects
| ||||||||||
| void |
setValue(Object value, double priority, DatabaseReference.CompletionListener listener)
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).
| ||||||||||
| void |
setValue(Object value, Map priority, DatabaseReference.CompletionListener listener)
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).
| ||||||||||
| Task<Void> |
setValue(Object value, String priority)
This method is deprecated.
Use
setValueAsync(Object, String)
| ||||||||||
| Task<Void> |
setValue(Object value, double priority)
This method is deprecated.
Use
setValueAsync(Object, double)
| ||||||||||
| void |
setValue(Object value, String priority, DatabaseReference.CompletionListener listener)
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).
| ||||||||||
| void |
setValue(Object value, DatabaseReference.CompletionListener listener)
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).
| ||||||||||
| Task<Void> |
setValue(Object value)
This method is deprecated.
Use
setValueAsync(Object)
| ||||||||||
| ApiFuture<Void> |
setValueAsync(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).
| ||||||||||
| ApiFuture<Void> |
setValueAsync(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).
| ||||||||||
| ApiFuture<Void> |
setValueAsync(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).
| ||||||||||
| Task<Void> |
updateChildren(Map<String, Object> update)
This method is deprecated.
Use
updateChildrenAsync(Map)
| ||||||||||
| void |
updateChildren(Map<String, Object> update, DatabaseReference.CompletionListener listener)
Ensure the data has the specified child values updated when the client is disconnected
| ||||||||||
| ApiFuture<Void> |
updateChildrenAsync(Map<String, Object> update)
Ensure the data has the specified child values updated when the client is disconnected
| ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
This method is deprecated.
Use cancelAsync().
Similar to cancelAsync() ()}, but returns a Task.
Task for this operation.Cancel any disconnect operations that are queued up at this location
| listener | A listener that will be triggered once the server has cancelled the operations |
|---|
Cancel any disconnect operations that are queued up at this location
This method is deprecated.
Use removeValueAsync()
Similar to removeValueAsync(), but returns a Task.
Task for this operation.Remove the value at this location when the client disconnects
| listener | A listener that will be triggered once the server has queued up the operation |
|---|
Remove the value at this location when the client disconnects
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.
| value | The value to be set when a disconnect occurs |
|---|---|
| priority | The priority to be set when a disconnect occurs |
| listener | A listener that will be triggered once the server has queued up the operation |
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.
| value | The value to be set when a disconnect occurs |
|---|---|
| priority | The priority to be set when a disconnect occurs |
| listener | A listener that will be triggered once the server has queued up the operation |
This method is deprecated.
Use setValueAsync(Object, String)
Similar to setValueAsync(Object, String), but returns a Task.
| value | The value to be set when a disconnect occurs |
|---|---|
| priority | The priority to be set when a disconnect occurs |
Task for this operation.
This method is deprecated.
Use setValueAsync(Object, double)
Similar to setValueAsync(Object, double), but returns a Task.
| value | The value to be set when a disconnect occurs |
|---|---|
| priority | The priority to be set when a disconnect occurs |
Task for this operation.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.
| value | The value to be set when a disconnect occurs |
|---|---|
| priority | The priority to be set when a disconnect occurs |
| listener | A listener that will be triggered once the server has queued up the operation |
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.
| value | The value to be set when a disconnect occurs |
|---|---|
| listener | A listener that will be triggered once the server has queued up the operation |
This method is deprecated.
Use setValueAsync(Object)
Similar to setValueAsync(Object), but returns a Task.
| value | The value to be set when a disconnect occurs |
|---|
Task for this operation.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.
| value | The value to be set when a disconnect occurs |
|---|---|
| priority | The priority to be set when a disconnect occurs |
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.
| value | The value to be set when a disconnect occurs |
|---|
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.
| value | The value to be set when a disconnect occurs |
|---|---|
| priority | The priority to be set when a disconnect occurs |
This method is deprecated.
Use updateChildrenAsync(Map)
Similar to updateChildrenAsync(Map), but returns a Task.
| update | The paths to update, along with their desired values |
|---|
Task for this operation.Ensure the data has the specified child values updated when the client is disconnected
| update | The paths to update, along with their desired values |
|---|---|
| listener | A listener that will be triggered once the server has queued up the operation |
Ensure the data has the specified child values updated when the client is disconnected
| update | The paths to update, along with their desired values |
|---|