Hello,
We are experiencing some issues with the real-time online/offline functionality. We are using JavaScript SDK chat@2.1.6 for our Angular 1 app and “@cometchat-pro/cordova-ionic-chat”: “^2.1.1” and “@cometchat-pro/ionic-calls”: “0.0.6” for our Ionic app.
For the Online/Offline user status functionality, after a successful cometchat login for our user we create listener, please see below a snippet of our code:
$scope.ListenForUsers = function () {
var userListenerId = (((new Date()).getTime() * 10000) + 621355968000000000) + makeid(10);
CometChat.addUserListener(
userListenerId,
new CometChat.UserListener({
onUserOnline: onlineUser => {
console.log(onlineUser);
},
onUserOffline: offlineUser => {
console.log(offlineUser);
}
})
);
}
}
While testing we observed that the listener catches online/offline event notification for all of the users stored withing our CometChat app, not just the users which are in the list of connections or friends of the logged in user. Is there a way that we can set an array of users that we want to lister for their activity within the system?
Also right now we receive multiple connect and disconnect events during our work session, actually the onUserOnline and onUserOffline is triggered multiple times within a minute (without us manually triggering a logout and log back in into CometChat) and a lot of times for the logged in user – is there anything that can be done for this?
Additionally, we noticed that the onUserOffline event is triggered with a bit of a delay (more that few minutes 3-4, and sometimes not at all). Although less often, we experienced delays in the onUserOnline section as well, sometimes they are of 1-2 minutes. Please note that the delays that are problematic for us are the ones greater than 5-10 seconds.
Thank you,
Ciprian