Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"title": "Handle Reachability updates on client side",
"description": "Handle an UpdateReason change and process the Reachability Indicators",
"type": "mobile"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// function called after client init to set up event handlers
function registerEventHandlers() {
user = conversationsClient.user;
// Register User updated event handler
user.on('updated', function(event) {
handleUserUpdate(event.user, event.updateReasons)
});
}

// function to handle User updates
function handleUserUpdate(user, updateReasons) {
// loop over each reason and check for reachability change
updateReasons.forEach(function(reason) {
if (reason == 'online') {
//do something
}
});
}