Support Topics Documentation Slack YouTube Blog

Any way to detect user presence?

Much like how major instant-messaging apps show whether a user is online (or when were they last seen), is there any possible way to detect this online presence in Backendless?

Hi!

  1. “Last seen” value is shown in column “lastLogin” in users table.
  2. Currently we don’t have this functionality (but this task is already added to the roadmap).
    You can add check for “is online/offline” with your client code or with Business Logic service:
  3. For example, create table “onlineUsers” in data service. After user’s successful login you set value true/false in column “isOnline”. You can do it with your sdk methods or with event handler “afterLogin”. You can find more info about Business Logic service here:
    https://backendless.com/documentation/business-logic/java/bl_overview.htm

Regards,
Kate.

Hello!

Is there any update regarding ways of detecting user presence/online status.

Thanks.

Hello @jaypee_peros

There is no built-in way to detect whether a user is online or not. But you can use the following algorithm:

  1. Use Backendless Cache to store the key online:<user-id> with value true each minute(or whatever you need) with expiration in 2 minutes.
  2. To check if a user is online you just call Backendless Cache ‘get’ method for the key online:<user-id> and if the value not null and true then the user is online
1 Like

Thank you, This helpful.