开发者

Pushing updates to the view in (close to) real-time

Say my user is viewing messages/index, and someone else sends him a message. I'd like the user's view to update in real-time to reflect the new message, kind of like how Twitter lets me know there are more messages on my timeline. Are there any examples of this being do开发者_Go百科ne in Rails?


You can either use AJAX to poll the server for updates on a regular basis (pull model), or use the Juggernaut plugin or similar to enable the server to send updates to the client (push model). Note that this requires Flash to be installed on the client.


DUI.stream from digg might be the solution you are looking for. It keeps an open xhr stream that you can keep on adding objects to to send to the user. It has a ruby client example

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜