Best Ruby on Rails WebSocket tool [closed]

2019-01-07 02:18发布

问题:

I started project in Rails 3 and I need to add notifications(like Facebook one). Best way would be using WebSocket for support devices like iPad, but I can't find any good tools to easy implement it in Rails. I found Pusherapp, but they prices are overwhelming, and also I don't think that providing my data to third party company would be wise. So things needed:

  • Open Source
  • Some kind of channels support
  • Helpers for Rails(and working with Rails 3)

回答1:

If you are searching plain WebSocket implementation, then EM-WebSocket is probably best. If you want support for non-flash fallback(like old phones or iPhone 3G) you should try Socket.IO-rack.

For full-featured implementations like Pusher(with authentication and channels) you have two opensource choices: Socky and Juggernaut.

Socky is a pure ruby project using EM-WebSocket(like pusher) and it has some nice tools for Rails. On the other hand Juggernaut has more history(and more users atm.) but the new version was rewritten to Node.JS(client is still ruby-based) and require Redis. Both should work fine.



回答2:

Take a look at faye.



回答3:

EM-WebSocket is probably the best Ruby implementation. In fact, Pusherapp is built on it. It integrates with EventMachine.

Here's a tutorial on how to use it.



回答4:

Another option that might meet your needs but is slightly more esoteric is to go with one of the Jruby appservers and use one of the Java websockets implementations. Jetty (the base for the Trinidad) is known to have the best websockets support available. Another option (which is pretty cool) is to use a messaging server with websocket wrappers for message endpoints. As an example, Torquebox (a dedicated Jruby/Rails appserver) has built-in support for HornetMQ, which in turn has support for websockets.