I just tried push notification, I can post message and received it from GCM.
Now I checked developer reference, I don't found a method used to retrieve all online users or a method just like notifyAllUsers.
When server required to post a message to all online users, i.e. server want to notify all users that server will be restarted in few minutes, is it possible?
This topic has been locked.
Pinned topic Can we notify all online users
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
IdanAdar 2700059KWB741 Posts
Re: Can we notify all online users2012-10-25T09:26:34ZThis is the accepted answer. This is the accepted answer.Define what is "online" for you.
A user whose online at this very instant? in the past 5 minutes? with the application connected to the server? with the application in the foregound?
What you can do is get the push event, and verify the state of the app in the client-side. If the state is what you want, then display the notification. Otherwise, don't.
IBM Worklight Mobile Platform
Re: Can we notify all online users2012-10-26T02:29:43ZThis is the accepted answer. This is the accepted answer.
- IdanAdar 2700059KWB
in my case online users means that that connected to server (assumes that they all logged into server) in both foreground background. if user go to home screen and open a document and want to go back to the app and input something, we also treat it as connected user, and they are expected to receive notifications.
I know an app bring to foreground, pending notification (received when app go background) will be shown. I want to notify all connected users. How I can get all logged user ID or a convenient API to notify all users without iterating over user list?
AntonAleksandrov 270005D80F55 Posts
Re: Can we notify all online users2012-10-28T09:04:03ZThis is the accepted answer. This is the accepted answer.Hello,
Worklight does not have an API for receiving a list of online users, as this is too generic.
You can create your own user storage/persistance layer like SQL database or a static application level Java object.
Then you can use this to save/delete user data to keep a list of online users.
Once again - this is completely manual.
Re: Can we notify all online users2012-10-29T02:49:35ZThis is the accepted answer. This is the accepted answer.