User presence and user login
Hi,
I'm developing a NodeJS app for monitoring the users status on my company.
I'm using the presence event, but i have some questions about it.
Are there any event to know when a user just logged in?
How can i receive presence events about other users in my company?
How can i know when i receive a presence event for what user is it, (the event not contains user id)?
Thanks in advance.
Regards.
-
Hi Pedro,
No, there is no event when the user is logged-in but by default, he will send a "Online" or equivalent presence event that you will be able to handle. When he will log-out, you will be notified by an "offline" presence event.
In order to receive events from others users, you need to invite them in your network. In order to do that, you have to call an API addToNetwork(contact):
- If the user is in the same company, he will be automatically added to your network and you will be added to his network. So you will receive events from him and he will receive events from you
- If the user is in an other company, he will add to accept or decline.
Using admin account, you can automatically add a user to the network of an other user by calling the API joinContacts(). This can be done after user creation for example.
The event is described here: https://hub.openrainbow.com/#/documentation/doc/sdk/node/api/events#Events+event_rainbow_onpresencechanged
You don't receive an ID but a JID. Every contacts contains 2 identifiers: an ID and a JID. We have API getContactFromID(), getContactFromJID() to retrieve the associated contact from an ID or a JID.
Hope that these answers will help you.
Regards,
Olivier
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire