Websockets and/or SSE on Heroku

I am deploying a system of dashboards that need to check for regular updates to various kinds of information. In a prototype, I used ActionController::Live and Server-Sent Events, but I found that approach overloaded the number of Unicorn workers I had deployed somewhat quickly, and eventually broke down into every dashboard app instance (each browser connected) just reloading each of the SSE connections every time Heroku or Unicorn cut them off. Essentially, some of the time I had instantaneous updates, and the rest of the time I had polling.

Iā€™m trying to figure out a more elegant solution to this problem. Iā€™ve been looking at some kind of pub/sub system with a second Heroku app thatā€™s using Faye. Iā€™m working on that prototype now, but itā€™s hard to find information on this topic with regard to hosting environments that isnā€™t just the Heroku documentation.

If I have 50+ dashboards (each with multiple panels that each have their own data) that are persistently connected to the server, plus another 500 clients that might be browsing at any time, is there a most efficient server-side solution to allow push updates that wonā€™t require me to spin up a huge number of dynos?

Have you tried the Pusher add-on? It provides websocket-based bidirectional pub/sub channels and setting it up is pretty easy.

Hi Raul,

Thatā€™s definitely in the mix. Thanks for the tip!

-Geoff

1 Like