org.atmosphere.gwt.client
Class AtmosphereClient
java.lang.Object
org.atmosphere.gwt.client.AtmosphereClient
- All Implemented Interfaces:
- UserInterface
public class AtmosphereClient
- extends Object
- implements UserInterface
This class is the Comet client. It will connect to the given url and notify the given CometListener of comet
events. To receive GWT serialized objects supply a CometSerializer method to parse the messages.
The sequence of events are as follows: The application calls CometClient#start().
CometListener#onConnected(int) gets called when the connection is established.
CometListener#onMessage(List) gets called when messages are received from the server.
CometListener#onDisconnected() gets called when the connection is disconnected this includes connection
refreshes. CometListener#onError(Throwable, boolean) gets called if there is an error with the connection.
The Comet client will attempt to maintain to connection when disconnections occur until the application calls
CometClient#stop().
The server sends heart beat messages to ensure the connection is maintained and that disconnections can be detected
in all cases.
- Author:
- Richard Zschech
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AtmosphereClient
public AtmosphereClient(String url,
AtmosphereListener listener)
AtmosphereClient
public AtmosphereClient(String url,
AtmosphereGWTSerializer serializer,
AtmosphereListener listener)
AtmosphereClient
public AtmosphereClient(String url,
AtmosphereGWTSerializer serializer,
AtmosphereListener listener,
boolean webSocketsEnabled)
isWebSocketsEnabled
public boolean isWebSocketsEnabled()
setWebSocketsEnabled
public void setWebSocketsEnabled(boolean webSocketsEnabled)
getUrl
public String getUrl()
setUrl
public void setUrl(String url)
getSerializer
public AtmosphereGWTSerializer getSerializer()
getListener
public AtmosphereListener getListener()
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
getConnectionTimeout
public int getConnectionTimeout()
setReconnectionTimeout
public void setReconnectionTimeout(int reconnectionTimout)
getReconnectionTimeout
public int getReconnectionTimeout()
getReconnectionCount
public int getReconnectionCount()
setReconnectionCount
public void setReconnectionCount(int reconnectionCount)
- Set to -1 to keep trying
- Parameters:
reconnectionCount -
isRunning
public boolean isRunning()
getConnectionID
public int getConnectionID()
post
public void post(Object message)
- Specified by:
post in interface UserInterface
post
public void post(Object message,
com.google.gwt.user.client.rpc.AsyncCallback<Void> callback)
- Specified by:
post in interface UserInterface
post
public void post(List<?> messages)
- Specified by:
post in interface UserInterface
post
public void post(List<?> messages,
com.google.gwt.user.client.rpc.AsyncCallback<Void> callback)
- Specified by:
post in interface UserInterface
broadcast
public void broadcast(Object message)
- Specified by:
broadcast in interface UserInterface
broadcast
public void broadcast(List<?> messages)
- Specified by:
broadcast in interface UserInterface
start
public void start()
- Specified by:
start in interface UserInterface
stop
public void stop()
- Specified by:
stop in interface UserInterface
split
public static com.google.gwt.core.client.JsArrayString split(String string,
String separator)
Copyright © 2012. All Rights Reserved.