Class ClientWebSocketContainer
java.lang.Object
org.springframework.integration.websocket.IntegrationWebSocketContainer
org.springframework.integration.websocket.ClientWebSocketContainer
- All Implemented Interfaces:
DisposableBean
,Lifecycle
,Phased
,SmartLifecycle
public final class ClientWebSocketContainer
extends IntegrationWebSocketContainer
implements SmartLifecycle
The
IntegrationWebSocketContainer
implementation for the client
Web-Socket connection.
Represent the composition over an internal ConnectionManagerSupport
implementation.
Accepts the clientSession
WebSocketSession
on
ConnectionManagerSupport.openConnection()
event, which can be accessed from this container using getSession(String)
.
- Since:
- 4.1
- Author:
- Artem Bilan, Gary Russell
-
Field Summary
Fields inherited from class org.springframework.integration.websocket.IntegrationWebSocketContainer
DEFAULT_SEND_BUFFER_SIZE, DEFAULT_SEND_TIME_LIMIT, logger, sessions, webSocketHandler
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ConstructorDescriptionClientWebSocketContainer
(WebSocketClient client, String uriTemplate, Object... uriVariables) -
Method Summary
Modifier and TypeMethodDescriptionint
getPhase()
getSession
(String sessionId) Return theclientSession
WebSocketSession
.boolean
boolean
Returntrue
if theclientSession
is opened.boolean
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
void
setPhase
(int phase) void
start()
void
stop()
void
Methods inherited from class org.springframework.integration.websocket.IntegrationWebSocketContainer
addSupportedProtocols, closeSession, destroy, getSessions, getSubProtocols, getWebSocketHandler, setMessageListener, setSendBufferSizeLimit, setSendTimeLimit, setSupportedProtocols
-
Constructor Details
-
ClientWebSocketContainer
-
-
Method Details
-
setOrigin
-
setHeadersMap
-
setHeaders
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout) Set the connection timeout in seconds; default: 10.- Parameters:
connectionTimeout
- the timeout in seconds.- Since:
- 4.2
-
getSession
Return theclientSession
WebSocketSession
. Independently of provided argument, this method always returns only the establishedclientSession
- Overrides:
getSession
in classIntegrationWebSocketContainer
- Parameters:
sessionId
- thesessionId
. Can benull
.- Returns:
- the
clientSession
, if established.
-
setAutoStartup
public void setAutoStartup(boolean autoStartup) -
setPhase
public void setPhase(int phase) -
isConnected
public boolean isConnected()Returntrue
if theclientSession
is opened.- Returns:
- the
WebSocketSession.isOpen()
state. - Since:
- 4.2.6
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceSmartLifecycle
-
getPhase
public int getPhase()- Specified by:
getPhase
in interfacePhased
- Specified by:
getPhase
in interfaceSmartLifecycle
-
isRunning
public boolean isRunning() -
start
public void start() -
stop
public void stop() -
stop
- Specified by:
stop
in interfaceSmartLifecycle
-