|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.gwt.client.AtmosphereClient
public class AtmosphereClient
This class is the client interface. It will connect to the given url and notify the given
AtmosphereListener of events. To receive GWT serialized objects supply a AtmosphereGWTSerializer
class with the appropriate annotations.
start().
AtmosphereListener.onConnected(int,int) gets called when the connection is established.
AtmosphereListener.onMessage(List) gets called when messages are received from the server.
AtmosphereListener.onDisconnected() gets called when the connection is disconnected
AtmosphereListener.onError(Throwable, boolean) gets called if there is an error with the connection.
For more details about the possible events see AtmosphereListener.
The client will attempt to maintain a connection when disconnections occur until the application calls
stop().
The server sends heart beat messages to ensure the connection is maintained and that disconnections can be detected
in all cases.
| 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<?> messages)
Send a message back to the server on this connection and use our broadcaster to send this message to other clients connected to the same broadcaster. |
void |
broadcast(Object message)
Send a message back to the server on this connection and use our broadcaster to send this message to other clients connected to the same broadcaster. |
int |
getConnectionID()
The unique connection ID |
int |
getConnectionTimeout()
|
AtmosphereListener |
getListener()
|
int |
getReconnectionCount()
|
int |
getReconnectionTimeout()
|
AtmosphereGWTSerializer |
getSerializer()
|
String |
getUrl()
|
boolean |
isRunning()
This is true between start() and stop()
If the connection is failing and the reconnectionCount has been reached then stop is also called. |
boolean |
isWebSocketsEnabled()
|
void |
post(List<?> messages)
push messages back to the server on this connection. |
void |
post(List<?> messages,
com.google.gwt.user.client.rpc.AsyncCallback<Void> callback)
push messages back to the server on this connection. |
void |
post(Object message)
push message back to the server on this connection. |
void |
post(Object message,
com.google.gwt.user.client.rpc.AsyncCallback<Void> callback)
push message back to the server on this connection. |
void |
setConnectionTimeout(int connectionTimeout)
This is the amount of time the client waits until a connection is established. |
void |
setReconnectionCount(int reconnectionCount)
The amount of times to try to reconnect if a connection has failed. |
void |
setReconnectionTimeout(int reconnectionTimeout)
This establishes the wait time before a new connection is started. |
void |
setUrl(String url)
|
void |
setWebSocketsEnabled(boolean webSocketsEnabled)
|
static com.google.gwt.core.client.JsArrayString |
split(String string,
String separator)
|
void |
start()
This will startup the connection to the server and the client will try to maintain the connection until is called. |
void |
stop()
End the connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AtmosphereClient(String url,
AtmosphereListener listener)
public AtmosphereClient(String url,
AtmosphereGWTSerializer serializer,
AtmosphereListener listener)
public AtmosphereClient(String url,
AtmosphereGWTSerializer serializer,
AtmosphereListener listener,
boolean webSocketsEnabled)
| Method Detail |
|---|
public boolean isWebSocketsEnabled()
public void setWebSocketsEnabled(boolean webSocketsEnabled)
public String getUrl()
public void setUrl(String url)
public AtmosphereGWTSerializer getSerializer()
public AtmosphereListener getListener()
public void setConnectionTimeout(int connectionTimeout)
connectionTimeout - the timeout in milliseconds defaults to 10000public int getConnectionTimeout()
public void setReconnectionTimeout(int reconnectionTimeout)
reconnectionTimeout - setReconnectionCount(int)public int getReconnectionTimeout()
public int getReconnectionCount()
public void setReconnectionCount(int reconnectionCount)
stop() and isRunning()
will return false.
reconnectionCount - Set to -1 to keep trying (default -1)public boolean isRunning()
start() and stop()
If the connection is failing and the reconnectionCount has been reached then stop is also called.
public int getConnectionID()
public void post(Object message)
AtmosphereGwtHandler#doPost
post in interface UserInterface
public void post(Object message,
com.google.gwt.user.client.rpc.AsyncCallback<Void> callback)
AtmosphereGwtHandler#doPost
post in interface UserInterfacepublic void post(List<?> messages)
AtmosphereGwtHandler#doPost
post in interface UserInterface
public void post(List<?> messages,
com.google.gwt.user.client.rpc.AsyncCallback<Void> callback)
AtmosphereGwtHandler#doPost
post in interface UserInterfacepublic void broadcast(Object message)
broadcast in interface UserInterfacepublic void broadcast(List<?> messages)
broadcast in interface UserInterfacepublic void start()
start in interface UserInterfacepublic void stop()
stop in interface UserInterface
public static com.google.gwt.core.client.JsArrayString split(String string,
String separator)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||