Is Proper Presence With REST Possible?

67 views
Skip to first unread message

James

unread,
Apr 21, 2016, 9:55:31 PM4/21/16
to Firebase Google Group
Hi all,

I'm interfacing with Firebase via a Unity3D client (and lovin' it).

However, I seem to have come to a roadblock where I'm not sure that the REST api will be able to meet the product's specifications. My app needs to have the ability to monitor which users are currently active, which seems like a trivial task if I could use the Firebase SDK.
Unfortunately, I'm not able to use that, so if the user's app is closed forcefully, or if there network drops, the firebase node storing the user's presence is not updated.

Is there any other way for me to create a onDisconnect() call using REST? Perhaps with me opening up an event-stream instead of a websocket?

Any advice at all is appreciated,

--James

Kato Richardson

unread,
Apr 28, 2016, 3:41:40 PM4/28/16
to Firebase Google Group
Hi James,

REST isn't going to be a good fit for presence monitoring. An alternative would be to use a heartbeat/keepalive by simply writing a timestamp to some path in Firebase. You could assume if the timestamp isn't updated in a reasonable span that the user has logged out (this is, of course, essentially what the socket connections do behind the scenes and how onDisconnect() works).

It would be important to think about scale if you take this route. A few hundred thousand users updating this every second would get expensive, so calculating a reasonable update frequency would be important.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/97db10d2-a9d6-4149-a25a-92aa48f89b56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

James

unread,
May 14, 2016, 11:27:05 AM5/14/16
to Firebase Google Group
Thanks for the response.

I ended up just viewing the websocket frames from firebase in Chrome and replicated that directly in-app. It ended up being quite a bit easier than I had anticipated.
I would share my pseudo-Csharp api that I built in this way, but unfortunately I don't own the rights to it.

--James
Reply all
Reply to author
Forward
0 new messages