用 rails 4 服务器端事件替换 Faye?Faye VS rails 4 流媒体? [英] Replace Faye with rails 4 server side events? Faye VS rails 4 streaming?

查看:48
本文介绍了用 rails 4 服务器端事件替换 Faye?Faye VS rails 4 流媒体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在使用 private_pub + faye 在 Rails 4 项目中进行一些基本的流式传输.是否可以替换 faye 和 private_pub 并使用 Rails 4 流(服务器发送事件代替?)

Currently im using private_pub + faye to have some basic streaming in Rails 4 project. Would it be possible to replace faye and private_pub and use Rails 4 streaming ( server send events instead ?)

我只是将数据推送给客户端,而客户端不会与服务器进行任何通信,因此看起来应该是可能的.

Im just pushing data to the client and the client does not communicate back to the server for anything so it seems like it should be possible.

faye web sockets与internetexplorer浏览器中的rails 4相比如何?兼容吗?

How does faye web sockets compare to rails 4 inside internet exploder browser? Is it compatible?

推荐答案

要运行 Rails 4 流式传输,您至少需要 Chrome 9+、Firefox 6.0+、Opera 11+、Safari 5+、iOS Safari 4.0+、Blackberry、Opera移动设备、Android 版 Chrome 或 Android 版 Firefox.对于旧版本的 IE,您可以使用 EventSource polyfill,但 SSE 的缺点之一是它们不支持双向通信.

To run Rails 4 streaming you need at least Chrome 9+, Firefox 6.0+, Opera 11+, Safari 5+, iOS Safari 4.0+, Blackberry, Opera Mobile, Chrome for Android or Firefox for Android. For older versions of IE, you can use EventSource polyfill but one of the downsides of SSEs is that they do not support bi-directional communication.

Faye 应该在任何具有以下功能之一的浏览器中运行:

Faye should run in any browser capable of one of the following:

  • WebSockets(包括从 0.6.4 开始的 Firefox 6 和 Chrome 14 实现)
  • XMLHttpRequest
  • CORS
  • JSON-P

基本上,两种方案最大的区别是 Faye 是基于 Bayeux 协议,这意味着Faye 应该适用于所有实现 Bayeux 协议的浏览器和服务器(目前 Faye 服务器实现了 Node.js和红宝石)

Basically, the biggest diference between two solution is that Faye is based on Bayeux protocol, this means that the Faye should works in all browsers and servers that implements Bayeux protocol (currently Faye server implements Node.js and Ruby)

我认为最好继续使用 private_pub 和 Faye,因为两者都更稳定,您可以在互联网上找到有关它们的更多信息.

I think is better continue with private_pub and Faye because both are more stable and you can find more information about them on the internet.

我希望这会有所帮助.

这篇关于用 rails 4 服务器端事件替换 Faye?Faye VS rails 4 流媒体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆