org.atmosphere.gwt.client.impl
Class HTTPRequestCometTransport
java.lang.Object
org.atmosphere.gwt.client.impl.BaseCometTransport
org.atmosphere.gwt.client.impl.StreamingProtocolTransport
org.atmosphere.gwt.client.impl.HTTPRequestCometTransport
- All Implemented Interfaces:
- CometTransport
public class HTTPRequestCometTransport
- extends StreamingProtocolTransport
This class uses a XmlHttpRequest and onreadystatechange events to process stream events.
The main issue with this implementation is that GWT does not generate RECEIVING events from its XMLHTTPRequest. The
implementation of XMLHTTPRequest included in this package overrides that behaviour.
Another issues is that the memory required for the XMLHTTPRequest's responseText constantly grows so the server
occasionally disconnects the client who then reestablishes the connection.
The protocol for this transport is a '\n' separated transport messages. The different types of transport message are
identified by the first character in the line as follows:
! A connection message followed by the heartbeat duration as an integer
? A clean server disconnection message
# A heartbeat message
* A padding message to cause the browser to start processing the stream
] A string message that needs unescaping
| A string message that does not need unescaping
[ A GWT serialized object
R, r or f A GWT deRPC object
string messages are escaped for '\\' and '\n' characters as '\n' is the message separator.
GWT serialized object messages are escaped by GWT so do not need to be escaped by the transport
- Author:
- Richard Zschech
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HTTPRequestCometTransport
public HTTPRequestCometTransport()
connect
public void connect(int connectionCount)
disconnect
public void disconnect()
- Specified by:
disconnect in interface CometTransport- Overrides:
disconnect in class BaseCometTransport
needPolling
protected boolean needPolling()
getUserAgent
public static String getUserAgent()
- Returns the browser's user agent.
- Returns:
- the user agent
Copyright © 2012. All Rights Reserved.