public final class ClientWebSocketContainer extends IntegrationWebSocketContainer implements SmartLifecycle
IntegrationWebSocketContainer
implementation for the client
Web-Socket connection.
Represent the composition over an internal ConnectionManagerSupport
implementation.
Accepts the clientSession
WebSocketSession
on
ClientWebSocketContainer.IntegrationWebSocketConnectionManager.openConnection()
event, which can be accessed from this container using getSession(String)
.
DEFAULT_SEND_BUFFER_SIZE, DEFAULT_SEND_TIME_LIMIT, logger, sessions, webSocketHandler
DEFAULT_PHASE
Constructor and Description |
---|
ClientWebSocketContainer(WebSocketClient client,
String uriTemplate,
Object... uriVariables) |
Modifier and Type | Method and Description |
---|---|
int |
getPhase() |
WebSocketSession |
getSession(String sessionId)
Return the
clientSession WebSocketSession . |
boolean |
isAutoStartup() |
boolean |
isConnected()
Return
true if the clientSession is opened. |
boolean |
isRunning() |
void |
setAutoStartup(boolean autoStartup) |
void |
setConnectionTimeout(int connectionTimeout)
Set the connection timeout in seconds; default: 10.
|
void |
setHeaders(HttpHeaders headers) |
void |
setHeadersMap(Map<String,String> headers) |
void |
setOrigin(String origin) |
void |
setPhase(int phase) |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
addSupportedProtocols, closeSession, destroy, getSessions, getSubProtocols, setMessageListener, setSendBufferSizeLimit, setSendTimeLimit, setSupportedProtocols
public ClientWebSocketContainer(WebSocketClient client, String uriTemplate, Object... uriVariables)
public void setOrigin(String origin)
public void setHeaders(HttpHeaders headers)
public void setConnectionTimeout(int connectionTimeout)
connectionTimeout
- the timeout in seconds.public WebSocketSession getSession(String sessionId)
clientSession
WebSocketSession
.
Independently of provided argument, this method always returns only the
established clientSession
getSession
in class IntegrationWebSocketContainer
sessionId
- the sessionId
. Can be null
.clientSession
, if established.public void setAutoStartup(boolean autoStartup)
public void setPhase(int phase)
public boolean isConnected()
true
if the clientSession
is opened.WebSocketSession.isOpen()
state.public boolean isAutoStartup()
isAutoStartup
in interface SmartLifecycle
public int getPhase()
getPhase
in interface Phased
getPhase
in interface SmartLifecycle
public void stop(Runnable callback)
stop
in interface SmartLifecycle