如何做到实时更新类似于谷歌文件? [英] How to do live updating similar to Google Docs?

查看:262
本文介绍了如何做到实时更新类似于谷歌文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的事情非常类似于谷歌文档的实时更新 - 在这里所有用户都可以立即看到文档的其他用户的行为

I want to do something very similar to Google Doc's live updating - where all users can "immediately" see the actions of the other users in the doc.

要做到这一点,我的想法至今:

To achieve this, my ideas so far:

  • 在连续AJAX请求正在后台做了(这似乎性能密集型)?
  • 当然,有没有一种方法让服务器推送通知到所有客户端和相应地更新呢?
  • 在Ajax请求每隔X秒缓冲/延时动作要完成这些X秒(模拟实时效果)?

我想知道在试图达到这样的效果别人的经验。什么是做到这一点的最好方法是什么?

I would like to know others experience in trying to achieve this effect. What is the best way to do this?

所有帮助AP preciated。

All help is appreciated.

注意:我不是专门找一个实时文档编辑解决方案。我正在寻找一个解决方案是什么谷歌没有与他们的文档同一个概念。我将实际使用该溶液在一个稍微不同的方式进行。

NOTE: I'm not specifically looking for a real-time document editing solution. I'm looking for a solution to the same concept of what Google does with their Docs. I will actually be using that solution in a slightly different manner.

推荐答案

我投长轮询策略:每个客户端打开一个向服务器发出请求,但服务器从未打破了连接,并只发送Java的脚本块不时

I vote for Long-poll strategy : each client opens a request to the server, but the server never breaks up connections, and just send pieces of java-script from time to time.

恒AJAX请求会杀了你的服务器。

Constant AJAX requests would kill your server.

这篇关于如何做到实时更新类似于谷歌文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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