support for custom queries + presence update handler

This commit is contained in:
Adhiraj
2020-04-17 18:34:36 +05:30
parent 9ea4b0b381
commit 2cd560c430
5 changed files with 20 additions and 1 deletions

View File

@@ -19,6 +19,10 @@ client.handlers.onConnected = () => {
Despite the convenience, be careful with this file
*/
}
// called when someone's presence is updated
client.handlers.presenceUpdated = (id, type) => {
console.log("presence of " + id + " is " + type)
}
// called when you have a pending unread message or recieve a new message
client.handlers.onUnreadMessage = (m) => {
// console.log("recieved message: " + JSON.stringify(m)) // uncomment to see what the raw message looks like
@@ -58,6 +62,7 @@ client.handlers.onUnreadMessage = (m) => {
}
}, 4*1000) // send after 4 seconds
}
// called if an error occurs
client.handlers.onError = (err) => console.log(err)
client.handlers.onDisconnect = () => { /* internet got disconnected, save chats here or whatever; will reconnect automatically */ }