public class AtmospherePushConnection extends Object implements PushConnection
PushConnection
implementation using the Atmosphere push support
that is by default included in Vaadin.
For internal use only. May be renamed or removed in a future release.
Modifier and Type | Class and Description |
---|---|
protected static class |
AtmospherePushConnection.FragmentedMessage
Represents a message that can arrive as multiple fragments.
|
protected static class |
AtmospherePushConnection.State |
Constructor and Description |
---|
AtmospherePushConnection(UI ui)
Creates an instance connected to the given UI.
|
Modifier and Type | Method and Description |
---|---|
void |
connect(org.atmosphere.cpr.AtmosphereResource resource)
Associates this
AtmospherePushConnection with the given
AtmosphereResource representing an established push connection. |
void |
connectionLost()
Called when the connection to the client has been lost.
|
void |
disconnect()
Closes the connection.
|
static void |
enableAtmosphereDebugLogging()
Internal method used for reconfiguring loggers to show all Atmosphere log
messages in the console.
|
static String |
getAtmosphereVersion()
Gets the Atmosphere version in use, as reported by
Version.getRawVersion() . |
protected org.atmosphere.cpr.AtmosphereResource |
getResource() |
protected AtmospherePushConnection.State |
getState()
Returns the state of this connection.
|
protected UI |
getUI() |
boolean |
isConnected()
Returns whether this connection is currently open.
|
void |
push()
Pushes pending state changes and client RPC calls to the client.
|
void |
push(boolean async)
Pushes pending state changes and client RPC calls to the client.
|
protected Reader |
receiveMessage(Reader reader)
Reads and buffers a (possibly partial) message.
|
protected void |
sendMessage(String message)
Sends the given message to the current client.
|
public AtmospherePushConnection(UI ui)
ui
- the UI to which this connection belongspublic static String getAtmosphereVersion()
Version.getRawVersion()
.public void push()
PushConnection
PushConnection.isConnected()
is false; the push will be deferred
until a connection is available. It is NOT safe to invoke this method if
not holding the session lock.
This is internal API; please use UI.push()
instead.
push
in interface PushConnection
public void push(boolean async)
isConnected()
is false, defers the push until a connection is
established.async
- True if this push asynchronously originates from the server,
false if it is a response to a client request.protected void sendMessage(String message)
isConnected()
returns false.message
- The message to sendprotected Reader receiveMessage(Reader reader) throws IOException
Reader
yielding the complete message.
Otherwise, returns null.reader
- A Reader from which to read the (partial) messageIOException
- if an IO error occurredpublic boolean isConnected()
PushConnection
isConnected
in interface PushConnection
public void connect(org.atmosphere.cpr.AtmosphereResource resource)
AtmospherePushConnection
with the given
AtmosphereResource
representing an established push connection.
If already connected, calls disconnect()
first. If there is a
deferred push, carries it out via the new connection.resource
- the resource to associate this connection withprotected UI getUI()
protected org.atmosphere.cpr.AtmosphereResource getResource()
public void disconnect()
PushConnection
PushConnection.isConnected()
is
false.disconnect
in interface PushConnection
public void connectionLost()
protected AtmospherePushConnection.State getState()
public static void enableAtmosphereDebugLogging()
Copyright © 2025. All rights reserved.