April 2018
Intermediate to advanced
284 pages
6h 43m
English
When we create Realtime Application with Firebase, we also need to monitor the connection when clients connect and disconnect with database. Firebase provides a simple solution, which you can use to write to the database when a client disconnects from the Firebase Database servers. We can perform all operations such as writing, setting, updating, and removing can be performed upon a disconnection.
Refer to this example onDiscconnect() method of Firebase:
var presenceRef = firebase.database().ref("disconnectmessage");// Write the string when client loses connectionpresenceRef.onDisconnect().set("I disconnected!");
We can also attach the callback function to ensure that the onDisconnect() method ...