Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Figuring out who's online of a subset of users (Facebook Friends)

Avatar

Level 2

I have the following use case:A user signs up for my application, and initially starts out in their own room, however they have the option of joining a room of someone they have marked as a friend, or to invite an active user into their room. In this case I'm authenticating via Facebook, so I already have a list of unique identifiers (And I'm using uid and Name as the token inputs). My questions is: What is the best way of letting my user know when their friends are currently online and using the service?

I can think of three different solutions:

1- Create a single room that exists purely for roster purposes outside of the normal room activity, and run parallell sessions. At the moment I still think this is the best option, but it doesn't exactly scale because every user would receive notification events for every active user on the system. Using a Warcraft style "server" metaphor might work where I can limit the number of users in each roster room, but again that's not necessarily the best option.

2- Regularly poll the active room list from the server and let the users 'refresh' who's online. This is suboptimal because there's latency involved, and may not give an accurate list of who's available.

3- Knock on every friend's room as soon as the user is online, and have the UX treatment react via notifications rather than live status. Again suboptimal, because users would have to simultaneously join every friends' room that's active, and that gets expensive on the user minutes.

Now, from the discussions at MAX I know that server notifications and messaging are coming, but even those might not be the best option because most server API's you've provided are RESTful. In this case, I'd have to start playing around with sockets or use FMIS to handle user subscription events.

Any suggestions or reccomendations on which of these options to pursue?

2 Replies

Avatar

Employee

The notification services will be rest API (you provide a callback URL and we'll POST notifications when events occur) so in your case you will be able to "listen" to users entering a room and update your state. You will also be able to  POST messages to a room so you should be able to tell a user in a room that one of his friends has entered a different room.

Unfortunately we are not ready will all this yet so it may not be an option for you, but maybe you can temporarely implement your solution #2 and swap to our notification system when it's ready.

As an alternative you could implement #1 but have each user subscribes to a collection or a node that represent his buddy list. There is stil a "problem" that currently when you join a room you are automatically subscribed to the UserManager collection (so each user will be receiving notification for every other user in the system) but I am pushing to "fix" this in our framework and have the option to disable UserManager notifications if your application chooses to do so.

Avatar

Level 2

I'm just writing to say that I would love for this 'fix' to be implemented.  I'd like to be able to disable UserManager notifications for certain users of my app (but not for all users).  Most of my users do not need to know who else is in the room (just like if I walk into a store, I don't need to know about everyone else in the store - just need to be able to ask the staff questions).  Maybe this would be best implemented on the ConnectSession class..(e.g. something like connectSession.isSubscribeToUserManagerNotifications = false).

thnks

Mark