public class AtmospherePushConnection extends Object implements PushConnection
PushConnection implementation that uses Atmosphere for
handling the communication channel.| Modifier and Type | Class and Description |
|---|---|
static class |
AtmospherePushConnection.AbstractJSO |
static class |
AtmospherePushConnection.AtmosphereConfiguration |
static class |
AtmospherePushConnection.AtmosphereResponse |
protected static class |
AtmospherePushConnection.FragmentedMessage
Represents a message that should be sent as multiple fragments.
|
protected static class |
AtmospherePushConnection.State |
| Constructor and Description |
|---|
AtmospherePushConnection() |
| Modifier and Type | Method and Description |
|---|---|
protected AtmospherePushConnection.AtmosphereConfiguration |
createConfig() |
void |
disconnect(com.google.gwt.user.client.Command command)
Closes the push connection.
|
protected AtmospherePushConnection.AtmosphereConfiguration |
getConfig() |
String |
getTransportType()
Returns a human readable string representation of the transport type used
to communicate with the server.
|
void |
init(ApplicationConnection connection,
UIState.PushConfigurationState pushConfiguration)
Two-phase construction to allow using GWT.create().
|
boolean |
isActive()
Checks whether this push connection is in a state where it can push
messages to the server.
|
boolean |
isBidirectional()
Checks whether this push connection should be used for communication in
both directions or if an XHR should be used for client to server
communication.
|
protected void |
onClientTimeout(AtmospherePushConnection.AtmosphereResponse response) |
protected void |
onClose(AtmospherePushConnection.AtmosphereResponse response) |
protected void |
onConnect(AtmospherePushConnection.AtmosphereResponse response)
Called whenever a server push connection is established (or
re-established).
|
protected void |
onError(AtmospherePushConnection.AtmosphereResponse response)
Called if the push connection fails.
|
protected void |
onMessage(AtmospherePushConnection.AtmosphereResponse response) |
protected void |
onOpen(AtmospherePushConnection.AtmosphereResponse response) |
protected void |
onReconnect(com.google.gwt.core.client.JavaScriptObject request,
AtmospherePushConnection.AtmosphereResponse response) |
protected void |
onReopen(AtmospherePushConnection.AtmosphereResponse response) |
protected void |
onTransportFailure()
Called if the transport mechanism cannot be used and the fallback will be
tried.
|
void |
push(elemental.json.JsonObject message)
Pushes a message to the server.
|
public void init(ApplicationConnection connection, UIState.PushConfigurationState pushConfiguration)
PushConnectioninit in interface PushConnectionconnection - The ApplicationConnectionpublic boolean isActive()
PushConnectionPushConnection.disconnect(Command) has been called.isActive in interface PushConnectiontrue if this connection can accept new messages;
false if this connection is disconnected or
disconnecting.public boolean isBidirectional()
PushConnectionisBidirectional in interface PushConnectionpublic void push(elemental.json.JsonObject message)
PushConnectionPushConnection.isActive()).
Implementation detail: If the push connection is not connected and the
message can thus not be sent, the implementation must call
ConnectionStateHandler.pushNotConnected(JsonObject), which will
retry the send later.
This method must not be called if the push connection is not
bidirectional (if PushConnection.isBidirectional() returns false)
push in interface PushConnectionmessage - the payload to pushPushConnection.isActive()protected AtmospherePushConnection.AtmosphereConfiguration getConfig()
protected void onReopen(AtmospherePushConnection.AtmosphereResponse response)
protected void onOpen(AtmospherePushConnection.AtmosphereResponse response)
protected void onConnect(AtmospherePushConnection.AtmosphereResponse response)
response - public void disconnect(com.google.gwt.user.client.Command command)
PushConnection
After this method has been called, PushConnection.isActive() returns
false. Calling this method for a connection that is no
longer active will throw an exception.
disconnect in interface PushConnectioncommand - callback command invoked when the connection has been properly
disconnectedprotected void onMessage(AtmospherePushConnection.AtmosphereResponse response)
protected void onTransportFailure()
protected void onError(AtmospherePushConnection.AtmosphereResponse response)
protected void onClose(AtmospherePushConnection.AtmosphereResponse response)
protected void onClientTimeout(AtmospherePushConnection.AtmosphereResponse response)
protected void onReconnect(com.google.gwt.core.client.JavaScriptObject request,
AtmospherePushConnection.AtmosphereResponse response)
protected AtmospherePushConnection.AtmosphereConfiguration createConfig()
public String getTransportType()
PushConnectiongetTransportType in interface PushConnectionCopyright © 2023 Vaadin Ltd. All rights reserved.