AJAX仍然是一种轮询技术
我已经阅读了 AJAX 和推送技术。 AJAX 仍然是一种拉动技术,仍然需要 Java Pushlets 和 Tomcat Comet 等推送技术吗?
换句话说,数据从服务器推送到客户端是否正确。然后客户端使用 AJAX 提取该数据并将其放置在 Web 浏览器上?
I have read up on AJAX and pushing technologies. Is AJAX still a pulling technology that still requires Push Technology such as Java Pushlets and Tomcat Comet?
In another words is it correct to say, that Data is being push from server to client. then client pulls that data using AJAX to place it on web browser?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,ajax 从 Tomcat 或其他网络服务器查询数据,但是 ajax 请求和普通请求之间从服务器轮询数据是有区别的,
下面这张图片可能会让您清楚这一点:
(来源:javalobby.org)
正如您在上图中看到的,它仅在请求之间轮询所需的数据,而不从服务器查询整个页面。
Yes ajax queries data from a webserver like tomcat or others but there is a difference in polling data from the server between an ajax request and a normal request
Here is an image which may make this clear to you:
(source: javalobby.org)
so as you can see in the above image it only polls the required data between requests and doesn't query the whole page from the server.
在 AJAX 中,总是由浏览器发起与服务器的操作/联系,是的。
据我所知,页面加载完成后无法推送数据。
In AJAX, it's always the browsers that initiates the action/contact with the server, yes.
To the best of my knowledge, there is no way to push data after the page has completed loading.
从技术上讲,您可以使用 AJAX 长轮询或 XHR 流来实现基于推送的消息传递。这些技术既保持与服务器的连接处于活动状态,又允许基于事件的消息传递。
还值得注意的是,使用适当的服务器软件,您可以支持 WebSockets(HTML5 的一项功能),主流浏览器的下一版本都支持 WebSockets。
也在那里,尽管它仅受 Opera (booooo) 支持。这两种技术都允许无缝推送消息。Technically speaking, you can use AJAX long polling or XHR streaming to achieve push-based messaging. These techniques both keep a connection to the server alive and allow for event-based messaging.
It is also worth noting that with appropriate server software, you can support WebSockets (a feature of HTML5), which are supported by the next version of the major browsers.
<eventsource>
is also out there, though it is only supported by Opera (booooo). Both of these technologies allow for seamless push messaging.