Rails 3: Real-time server push?

2019-04-07 20:04发布

I'm trying to write a Rails 3 application in which a server can push data to multiple clients in real time.

I've heard of Juggernaut, but I've also heard that it does not work with Rails 3. I tried APE (AJAX Push Engine), but I'm not having much luck with it.

I'm very new to Rails. I can't find many guides that involve real-time push, and Rails 3. I was looking for a free, easy (if possible) solution to this. If anyone could point me in the right direction, I'd greatly appreciate it.

5条回答
混吃等死
2楼-- · 2019-04-07 20:12

You can try juggernaut to do what you want.

The github repository : https://github.com/maccman/juggernaut Example of application with juggernaut : https://github.com/maccman/holla

Enjoy :)

查看更多
迷人小祖宗
3楼-- · 2019-04-07 20:13

Have you looked into http://socket.io ? It powers the push functions behind Juggernaut, if I recall correctly.

There appears to be a library for Rails here: https://github.com/markjeee/Socket.IO-rack -- it says 2.3+, which I assume means 3 is ok (though I'm not a Ruby guy, so I wouldn't really know).

查看更多
Fickle 薄情
4楼-- · 2019-04-07 20:21

Check out Faye: http://faye.jcoglan.com/ - I hear really good things about it.

if you're looking for a hosted solution, i've used Pusher http://pusher.com/ in the past, and loved it. i converted a site that used ajax polling over to pusher in about 30 minutes.

查看更多
【Aperson】
5楼-- · 2019-04-07 20:24

Starting with Rails 4, you could also use Entangled:

https://github.com/so-entangled/rails

It basically keeps all data between client and server in sync in real time through web sockets. It's easy to set up, so give it a try.

查看更多
淡お忘
6楼-- · 2019-04-07 20:32

In keeping with the Pusher suggestion, there's RMSN - a drop in replacement I've written using NowJS. https://github.com/leppert/RMSN

查看更多
登录 后发表回答