Starting socket server in ruby on rails on cloud environments (heroku)
I'm using heroku, and I can push a Ruby on Rails app just fine, I'm trying to convert this to a Socket server, basically I would need to bind to an open port, in this case, I know Heroku only does 80 22 and 443.
Is it possible to bind to port 80 on those environments?
Also, how would I setup the entry point for this socket server, all I know is that when script/server it boots up the app.
Do I have to put the function call there? How can a socket server start instead of the rails app on top of whatever webserver heroku has.
Currently there's no way to route non-HTTP traffic to your app. Heroku binds Ruby web servers to various ports and hosts behind the scenes and then routes traffic to those processes based on the Host in your HTTP header. Requests lasting longer than 30s are assumed to be hung, and are terminated.
In the event that you have a long-running process that you don't need to communicate with via a socket you can simply use a worker. I'd recommend a tool like MongoDB for storing results of computations and a library like Delayed::Job for queuing.
Having said all that, there are definitely reasonable use cases which demand longer running processes and non-HTTP traffic, but at the moment Heroku doesn't support them.
I don't think this is possible on Heroku. They don't support this kind of architecture and you have limited control over the kinds of things you can run in the environment.
Might be worth having a look at Node.js support just announced ... currently in Beta, but might give you something to work with.