User Status - Online/Offline

Hi everyone,

I’m new to Backendless and moving from a server and I have a question that is important to the project that I could not find a proper answer. So, here I am.

This is a mobile app and web project where as soon as people connect to the server I can retrieve all connected/online users and, as a feature of, as soon as they close the browser window (on web) they are disconnected from the server.

Per what I have seen, I could make an api call to set user property to offline if we are talking about the mobile app. But what about the web version? is there something similar to where connected users are organized and I can retrieve them?

An additional question is: Can I run functions on the servers side if I only want to send information that match certain criteria?


Hi Thiago,

When a browser window is closed, your JS code can get a callback indicating that “event”:

This is when you can call the server to update the user status to “offline”.

Regarding this question:

Can I run functions on the servers side if I only want to send information that match certain criteria?

Yes, you can run your own code in the server-side business logic.


Thank you, Mark! Much appreciated! :slight_smile:

What about iOS/Android mobile devices. As far I know Backendless use Sockets communication for messaging while application is on foreground and PUSH on backend.

Is there any way to expose this “flag” to user object ? To provide status of:
Online - Backendless sockets connected
Mobile - Backendless sockets disconnected, device registered with APNs/FCM
Offline - Backendless sockets disconnected, no push configured

Or we need to create custom logic and change flag on our side ?


We do not use persistent sockets. This is something we plan on adding in the near future.

Until then, you could use the API to check if a device is registered, but it does not necessary would mean that the user is online.


Sorry but I dont really understand your meaning of “persistent sockets”

I guess to deliver messages while app is in foreground you are using sockets not APNs/FCM mechanism. What I wanted is exposing status of this connection from backendless server.

Currently I’ve created custom business method like:
changeStatus(status:Int) and I am calling this on change viewcycle of app, logout, login, on termination and similar events to change uses status in DB and then calling messaging API to broadcast message to all subscribers about that change (to update their UI)…but whole this architecture might be simplified just but mentioned exposure…

To delivery messages, we send them to APNS/FCM and their servers deliver to the actual devices. This is how classic push notifications are actually meant to work.

I dont understand what than broadcast mean:</img>

I thought that backendless supports both ways to deliver messages. So you are saying that for real-time chat for example, with lets say 5000 users you are sending APNs/FCM requests ? Instead of sockets comms ? (while obviously they are in foreground mode)


Backendless supports 2 messaging systems:

    publish/subscribe push notifications
Both can be used for chat implementations, while only Push notifications right now can be used to deliver a message to an app which is in background.

The pub/sub system does not use dedicated sockets, it retrieves messages via polling.


Ah :frowning:

Ok so by pooling you mean periodic GET requests ?
So is there any plan to implement something like webrtc, socketsio, mqtt ?

Yes, by polling I mean periodic GET requests.

We plan to add support for web sockets right after 4.0 goes out of beta.