实时运营转型和协作

发布于 2024-10-19 17:56:30 字数 452 浏览 4 评论 0原文

阅读此帖子后(可能,您可以通过查看图像来了解要点,无需阅读全文),我很难决定在哪一点需要 comet 类型技术。 在我(天真地)看来,所有这些都可以通过使用 ajax 请求和数据库来检索多个版本来完成。是这样吗?

可能我遗漏了一些东西,所以澄清一下就太好了。

更新: 鉴于Andrew写的有用答案,说ajax方法解决这个问题并不及时,我想知道为什么,即服务器发送到客户端的响应在哪个阶段会产生延迟?

After reading this post (probably, you can get the gist by looking at the images, no need to read the whole text), I'm having a hard time deciding at which point is needed the help of comet type technologies.
It looks to me (naively) that all of that can be accomplished by using ajax requests and a database to retrieve several versions. Is that true?.

Probably I'm missing something, so a clarification would be great.

UPDATE:
Given the helpful answer written by Andrew, saying that an ajax approach to this issue it is not timely, I was wondering why, that is, at which stage the response sent by the server to the client will produce a delay?.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太阳哥哥 2024-10-26 17:56:30

Comet 是 Ajax 请求。

为了使服务器能够将通知推送到用户浏览器(IE 任何时候你看到服务器在图表中发送更改),用户需要已经与服务器建立连接。使用 ajax 长轮询等来维护连接的方法就是术语 comet 所指的。

是的,您可以通过每 x 秒发送一个 Ajax 请求来实现这一点。但这是浪费,而且也不合时宜。

[编辑]

当我说它不及时时,我的意思是,使用 ajax 调用按时间间隔更新将会产生延迟,无论该时间间隔是多少。
服务器无法向客户端发送更新。它只能回答客户端的请求。因此,如果服务器获得新信息,它必须保留该信息,直到所有客户端返回并请求更新。在这样的场景中,人们可以编辑相同的信息并同时提交,这需要服务器来处理,这也是本文所要解决的问题。使用 Comet 框架只会减少发生这种情况的机会,因为不同的客户端会更好地同步。

Comet IS Ajax requests.

In order for the server to be able to push notifications to the users browsers(IE anytime you see the server sending a change in the diagrams), the user needs to have a connection with the server already. The method of maintaining that connection using ajax long polling or the like is what the term comet refers to.

Yes, you could implement this by sending an Ajax request every x seconds. But that is wasteful, and it is not timely.

[Edit]

When I say it's not timely, what I am saying is that, using an ajax call to update on an interval will have a delay of whatever that interval is.
The server CANNOT send an update to the client. It can only answer requests from the client. So if the server gets new information, it has to sit on it until all the clients come back and ask for an update. In a scenario like this people can edit the same information and commit it at the same time, which needs to be handled by the server, and which is what the article is addressing. Using a comet framework will just reduce the chances of this happening because the different clients will be better synced.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文