COMET 相对于 AJAX 的可能性
我最近开始了解 COMET 以及它如何在不接收来自页面本身的请求的情况下与客户端页面相对应。但我想知道这种技术有哪些可能性,与 AJAX 相比,这种技术非常高效且简单。
I recently came to know about COMET and how it can correspond to the client page without receiving a request from the page itself. But I was wondering what are the possibilities that arrives with this techniques, which is very efficient and easy in comparison to AJAX.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
越来越多的聊天网站 :-)
现在,认真地说,作为 HTML5 规范的一部分,WebSocket API 允许服务器将数据推送到客户端。这样做的一大优点是,客户端不再需要不断轮询服务器以获取更新,当有可用更新时,服务器会将数据推送到客户端并通知他这些更新,这将节省带宽并允许更高效的应用程序。现代浏览器已经支持它。另一方面,需要额外的服务器来处理协议。
More and more chat web sites :-)
Now seriously, being part of the HTML5 specification, the WebSocket API allows servers to push data to the client. A big advantage for this is that clients will no longer need to continuously poll the server for updates, when updates are available servers will push data to the client and notify him for those updates, which would preserve bandwidth and allow more efficient applications. Modern browsers already support it. On the other hand an additional server is needed for handling the protocol.
现在 comet.comet 的时间是反向 ajax。如果您在聊天应用程序中使用 ajax,则需要每次检查数据库更新,但在 comet 的情况下,所有内容都与服务器端事件有关。我们可以设置某些事件@服务器端然后当数据库更新时它会自动更新网页。也就是说我们不需要一直发出请求。这样我们就可以避免由于大量请求而导致服务器头痛,并且应用程序会更快。
这是一个使用 comet 的实时聊天示例。查看一下:www.zeitoun.net/articles/comet_and_php/start
its Beyond ajax
Now its the time of comet.comet is reverse ajax.If you are using ajax in chat applications u need to check everytime for database updations but in the case of comet its all about server side events.We can set the certain events @server side then it will automatically update the webpage when the database is getting updated.that is we dnt need to give requests all the time.So that we can avoid the server headache due to large no.of requests and the application will be very much faster.
This is a live chat example using comet.check it out:www.zeitoun.net/articles/comet_and_php/start
its beyond ajax