← Back to Upcase

Websockets and/or SSE on Heroku


(Geoff Harcourt) #1

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?


(Raul Murciano) #2

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


(Geoff Harcourt) #3

Hi Raul,

That’s definitely in the mix. Thanks for the tip!

-Geoff