Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebSockets and Heroku: pushing data to the user

I am build a real time web application using Ruby on Rails and Heroku seems to be the best option for hosting it.

I would prefer pushing new data to the user, when it becomes available, instead of pulling it by sending AJAX requests every few seconds.

Pusher seems to be suggested by Heroku for a such kind of job, but it has some limitations, brings additional costs, and makes you dependent on an external API.

Is there any other option to use WebSockets on Heroku?

like image 323
krn Avatar asked Apr 17 '11 10:04

krn


2 Answers

If you wanna do websockets you need to use a different server besides rails. And since your on heroku you don't have the flexibility.

Optionally you can host a websockets enabled node server on an ec2 micro instance. Then in your rails app when you want to push -- do a request to the node server and the it will go to the clients.

like image 101
eggie5 Avatar answered Oct 05 '22 18:10

eggie5


If you only need one way communication try using Server Side events.

like image 40
Eric Fode Avatar answered Oct 05 '22 18:10

Eric Fode