Server push works comet

2011-04-22  来源:本站原创  分类:Java  人气:89 

comet is a server "push" technology, an implementation, apache-tomcat comet provided support.

Here's what comet works:

Comet mainly using the client makes a request to the server, the server sends back the response content, and use javascript to create a long link to the "long connection", the connection does not receive or did not reach the connection to the server when the time limit has been waiting for the server message, if the server has news, and immediately display the latest information. Long connection time to time will re-issue the connection request to the server. Generated by the server when a new message receiver of the message to immediately check whether there is a long connection, if there is sent immediately, if not not sent.

Comet server implementation, need to inherit HttpServlet class that implements org.apache.catalina.CometProcessor interface, the server receives a client's request will be called when the event CometProcessor interface method, the object passed to a org.apache.catalina.CometEvent event ( .) CometEvent has four states: CometEvent.EventType.BEGIN, CometEvent.EventType.ERROR, CometEvent.EventType.END, CometEvent.EventType.READ. According to the status of the request to the server to the client to send the appropriate data.

Principle is probably the case, need a concrete implementation to continuously check the message MessageSender whether there is data in the container, there is immediately sent, not to wait; a connectorCleaner to constantly check out the client's connection, if the break-out open, such as the client re-sent a long connection.

To achieve the client's comet, due to the type and version of browser inconsistencies, so the client needs to achieve two different comet, one is the iframe long connection, one is a long stream connection. Iframe for kernel-based browsers ie, the kernel does not support the stream ie long connection, so long connection with the iframe solution. Client request data to the server, the server returns a page with a hidden iframe, the iframe from time to time to send data requests to the server to maintain a long connection, known as the "heartbeat." Stream is the realization of firefox's comet, stream support the connection status of the inquiry, that is, as you can inquire as CometEvent state of the connection, and according to the state to do different operations. Stream long connection will automatically connect to the server without a browser, like ie the kernel that need to refresh iframe to re-establish the connection.

Apache-tomcat on the comet's support, the need to modify the configuration of server.xml, add:

<Connector ConnectionTimeout="20000" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>

At this point the comet can be achieved

相关文章
  • Server push works comet 2011-04-22

    comet is a server "push" technology, an implementation, apache-tomcat comet provided support. Here's what comet works: Comet mainly using the client makes a request to the server, the server sends back the response content, and use javascript to

  • Comet: a long connection based on HTTP "server push" technology 2010-06-20

    Comet: The long connections based on http " Server push technology http://www.ibm.com/developerworks/cn/web/wa-lo-comet/

  • Comet, the next generation of reverse AJAX (or server push technology - Server-side push) 2010-07-10

    Understanding of Comet You may have heard of Comet, because it has recently received some attention. Comet is sometimes called reverse Ajax, or server-side push technology (server-side push). The idea is simple: push the data directly from the server

  • Comet push-based server iframe (Server Push) Example 2010-12-14

    Server push technology (Server Push) is the latest most popular Web technologies a popular term, it's not called Comet (Comet). It is the second AJAX followed by a much sought after Web technology. Comet is sometimes called reverse Ajax, or server-si

  • Comet: HTTP long connection based on a "server push" technology 2010-12-20

    http://www.ibm.com/developerworks/cn/web/wa-lo-comet/ Comet: HTTP long connection based on a "server push" technology Zhou Ting ( [email protected] ), Software Engineer, IBM China Software Development Laboratory Zhou Ting, Software Engineer, I

  • Comet: HTTP-based long connection "server push" technology 2010-12-20

    http://www.ibm.com/developerworks/cn/web/wa-lo-comet/ Comet: HTTP-based long connection "server push" technology Zhou Ting ( [email protected] ), Software Engineer, IBM China Software Development Lab Technology Zhou Ting, software engineer at

  • [Thesis] Server Push Technology Summary 1 2011-05-17

    Server Push Technology 1 Background "server push technology" (Server Pushing) is the latest most popular Web technologies a popular term. It is the second "Ajax" followed by a much sought after Web technology. "Server push technol

  • Asp.net server push technology (Server Push) 2010-03-01

    In the past, and server-side communications, most of us use the AJAX polling visit, that is, control the time interval in the Javascript, then at regular intervals to access a server, then access to data or notification. But this polling 90% of the v

  • DWR Server Push (server push technology) to achieve real-time chat 2010-06-05

    Transfer: http://rickycm.javaeye.com/blog/419380 Message when you have QQ, QQ will rock the small icon, and we can even set the QQ have a message, automatically pop up! Those in the C / S mode is very easy! If you want to B / S model on how to achiev

  • Server Push Technology 2010-06-12

    Two days of server push technology, first click on the record, and then test the re-write something.

  • DWR server push (long link) technology 2010-06-24

    1, DWR server push technology to achieve the basic steps: 1, using WebContextFactory for WebContext (page context) 2, set to push data page 3, create a script flow 4, for ScriptSession 5, for each page (ScriptSession) add to or update the data proces

  • flex server push dynamic graph shows 2010-09-02

    Information on the Internet to achieve the gravity reference sensor in the graphics display, use the server push mechanism to bring Blazeds function. 1.java code three-axis sensor, xyz public class Gsensor { private String month; private int xValue;

  • Asp.net的服务器推技术 (Server Push) 2014-11-28

    在以往的和服务器端通信技术中,我们多数使用的是AJAX轮询式访问,也就是在Javascript中控制时间间隔,然后每隔一段时间就访问一次服务器,然后获得数据或通知.但是这种轮询方式的访问有90%是在做无用功. 要想长时间保持服务器和浏览器之间的连接怎么办?长连接技术,这可不是什么新技术,用IFrame作为隐藏帧指向长请求页面的方法早已被很多人运用在互联网上,但是IFrame作为隐藏帧有一个弊端,那就是浏览器的进度条始终处在读取状态.为了使用户获得更好体验,"Google的天才们"使用了

  • 51.使用Tornado Web Server+Nginx构建Comet应用 2013-08-09

    一般的web应用,都会使用ajax轮询来获得服务器的更新.但轮询方式会增加服务器的压力,而且很多请求获得的数据并没有更新,这些请求都是无意义的,徒增服务器压力而已. 使用Comet技 术可以一定程度地解决以上问题.Comet的实现很多,大多数需要使用特定的HTTP Server来实现.本文介绍使用基于python的Tornado Web Server来实现Server Side的Comet,为了贴近生产环境,还会介绍Tornado如何配合Nginx工作. 安装 到http://www.torna

  • Server push technology Pushlets use of two 2010-08-16

    Comet Pushlet is an open source framework, designed to have much to learn from where applications for the development of lightweight Comet useful reference. Pushlets http://www.pushlets.com Pushlet download address is used observer models: the client

  • Android Server Push (服务器推送) 解决方案 2012-08-08

    设备: 服务器 android 手机(连接wifi可上网) 运行流程: 手机应用启动,打开后台服务,listen 端口 port1,并连接服务器与端口 port2 手机向服务器提交ip信息,服务器储存手机ip列表, 断开连接 现在输入要push 的信息并发送 服务器依据ip列表向 port1建立连接 若超时择跳过,并清楚ip记录,若建立连接择发送check信号 手机收到check信号,立刻从服务器pull下信息并显示 ps:这是下午想出来的方案,希望看到的同学提出修改建议,谢谢:)

  • DWR Server Push (server push technology) B / S IM 2010-03-29

    package com.lhq; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import org.directwebremoting.ScriptSession;

  • DWR Server Push(服务器推技术) 实现即时聊天功能(WEB) 2014-05-04

    原文 http://yourgame.iteye.com/blog/199079 当你有QQ消息时,QQ的小图标会晃动,我们甚至还可以设定QQ有消息时,自动弹出来! 这些在C/S模式下很容易实现!如果要在B/S模式如何来实现呢? 我们的肯定会想到在客服端调用ajax在后台不断的查询服务器.看是否有关于自己的消息.如果有则查询返回.这种做法肯定会大量的占用系统的资源!不可取! 现在DWR的反转AJAX功能.允许我们从服务器端来控制客服端.而不需要客户端来请求.服务器可以自动把消息发给指定的客户端!

  • On the comet Technology 2010-06-05

    1. What is COMET? Search Dictionary Comet Chinese is "comet" means, at first when I saw this word, I guess in the end behind the beautiful name what is it? He is a WEB application server push technology (Server Push). Server Push is like its own

  • AJAX-based long-polling (long-polling) example of the realization of COMET 2010-06-22

    What is a Comet? Explained: Alex Russell (Dojo Toolkit project Lead) said that based on long HTTP connection, no need to install browser plug-in "server push" technology, "Comet". There are two models to achieve the realization of Come