org.atmosphere.gwt.client
Class AtmosphereClient

java.lang.Object
  extended by org.atmosphere.gwt.client.AtmosphereClient

public class AtmosphereClient
extends Object

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

Constructor Summary
AtmosphereClient(String url, AtmosphereGWTSerializer serializer, AtmosphereListener listener)
           
AtmosphereClient(String url, AtmosphereGWTSerializer serializer, AtmosphereListener listener, boolean webSocketsEnabled)
           
AtmosphereClient(String url, AtmosphereListener listener)
           
 
Method Summary
 void broadcast(List<Serializable> messages)
           
 void broadcast(Serializable message)
           
 int getConnectionID()
           
 int getConnectionTimeout()
           
 AtmosphereListener getListener()
           
 int getReconnectionTimeout()
           
 AtmosphereGWTSerializer getSerializer()
           
 String getUrl()
           
 boolean isRunning()
           
 void post(List<Serializable> messages)
           
 void post(List<Serializable> messages, com.google.gwt.user.client.rpc.AsyncCallback<Void> callback)
           
 void post(Serializable message)
           
 void post(Serializable message, com.google.gwt.user.client.rpc.AsyncCallback<Void> callback)
           
 void setConnectionTimeout(int connectionTimeout)
           
 void setReconnectionTimeout(int reconnectionTimout)
           
 void setUrl(String url)
           
static com.google.gwt.core.client.JsArrayString split(String string, String separator)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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)
Method Detail

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()

isRunning

public boolean isRunning()

getConnectionID

public int getConnectionID()

post

public void post(Serializable message)

post

public void post(Serializable message,
                 com.google.gwt.user.client.rpc.AsyncCallback<Void> callback)

post

public void post(List<Serializable> messages)

post

public void post(List<Serializable> messages,
                 com.google.gwt.user.client.rpc.AsyncCallback<Void> callback)

broadcast

public void broadcast(Serializable message)

broadcast

public void broadcast(List<Serializable> messages)

start

public void start()

stop

public void stop()

split

public static com.google.gwt.core.client.JsArrayString split(String string,
                                                             String separator)


Copyright © 2012. All Rights Reserved.