How to keep alive a Firebase connection with Heroku?

624 views
Skip to first unread message

David

unread,
Dec 17, 2015, 3:08:13 PM12/17/15
to Firebase Google Group
I'm using a Heroku dyno (standard 1x professional) with Node.js to listen to .on() events from Firebase.
Is there any chance the websocket connection between Firebase and Heroku can somehow stops working, because of a timeout or any other reason?
If so, is there a way to guarantee that Heroku is listening to Firebase events as long as the dyno is up and running? Thanks!

Kato Richardson

unread,
Dec 17, 2015, 3:20:53 PM12/17/15
to Firebase Google Group
Hi David,

I seem to recall that Heroku will disconnect your web sockets and workers after some period of inactivity. Indeed, they have an article on creating web socket apps. Maybe that would help?

☼, 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/3c50decf-f02e-443e-86ad-53f01ef40cac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David

unread,
Dec 17, 2015, 4:37:33 PM12/17/15
to Firebase Google Group
Thanks for the reply, Kato. The Heroku docs indeed mention a timeout policy.
I don't know if anybody here has any experience with dealing with this issue (I haven't been able to find much information about this).
Would writing a piece of data (e.g. a Date.now() timestamp) every 30s from Heroku to a Firebase location be enough to keep the web socket connection alive?
Or would it only keep the connection to that specific location open, but not any other Firebase location with the same root?

Kato Richardson

unread,
Dec 17, 2015, 4:48:35 PM12/17/15
to Firebase Google Group
Hi David,

When I've created Heroku apps in the past, I've created a simple HTTP server listening on a port, and then set up Pingdom to poll them for uptime. That seems to be enough to keep things alive.

Note that they didn't have this guide on setting up web socket dynos at the time; that may be a more sophisticated option; haven't read through it yet.

☼, 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.
Reply all
Reply to author
Forward
0 new messages