最好的 Ruby on Rails WebSocket 工具

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4767268/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 00:09:54  来源:igfitidea点击:

Best Ruby on Rails WebSocket tool

ruby-on-railsruby-on-rails-3websocket

提问by Jero Toryaki

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:

我在 Rails 3 中开始了项目,我需要添加通知(如 Facebook 的通知)。最好的方法是将 WebSocket 用于 iPad 等支持设备,但我找不到任何好的工具来轻松在 Rails 中实现它。我找到了 Pusherapp,但它们的价格太高了,而且我不认为将我的数据提供给第三方公司是明智的。所以需要的东西:

  • Open Source
  • Some kind of channels support
  • Helpers for Rails(and working with Rails 3)
  • 开源
  • 某种渠道支持
  • Rails 的助手(和 Rails 3 一起工作)

采纳答案by Bernard Potocki

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

如果您正在搜索普通的 WebSocket 实现,那么EM-WebSocket可能是最好的。如果您想支持非闪存回退(如旧手机或 iPhone 3G),您应该尝试Socket.IO-rack

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

对于像 Pusher 这样的全功能实现(带有身份验证和通道),您有两个开源选择:SockyJuggernaut

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.

Socky 是一个使用 EM-WebSocket(如 pusher)的纯 ruby​​ 项目,它有一些不错的 Rails 工具。另一方面,Juggernaut 有更多的历史(和更多的用户 atm。)但新版本被重写为 Node.JS(客户端仍然是基于 ruby​​ 的)并且需要 Redis。两者都应该工作正常。

回答by Gonzih

Take a look at faye.

看看faye

回答by Adam Lassek

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

EM-WebSocket可能是最好的 Ruby 实现。事实上,Pusherapp 就是建立在它之上的。它与EventMachine集成。

Here's a tutorialon how to use it.

这是有关如何使用它的教程

回答by Ivar

Another option that might meet your needs but is slightly more esoteric is to go with one of the Jrubyappservers 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.

另一种可能满足您的需求但稍微深奥的选项是使用其中一个Jruby应用程序服务器并使用其中一个 Java websockets 实现。Jetty(Trinidad的基础)以拥有最好的 websockets 支持而闻名。另一种选择(非常酷)是使用带有 websocket 包装器的消息服务器作为消息端点。例如,Torquebox(一个专用的 Jruby/Rails 应用程序服务器)内置了对 HornetMQ 的支持,而后者又支持 websockets