Class ClientWebSocketContainer
java.lang.Object
org.springframework.integration.websocket.IntegrationWebSocketContainer
org.springframework.integration.websocket.ClientWebSocketContainer
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
public final class ClientWebSocketContainer
extends IntegrationWebSocketContainer
implements org.springframework.context.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
-
Field Summary
Fields inherited from class IntegrationWebSocketContainer
DEFAULT_SEND_BUFFER_SIZE, DEFAULT_SEND_TIME_LIMIT, lock, logger, sessionsFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionClientWebSocketContainer(org.springframework.web.socket.client.WebSocketClient client, String uriTemplate, Object... uriVariables) ClientWebSocketContainer(org.springframework.web.socket.client.WebSocketClient client, URI uri) Constructor with a preparedURI. -
Method Summary
Modifier and TypeMethodDescriptionintgetPhase()org.springframework.web.socket.WebSocketSessiongetSession(@Nullable String sessionId) Return theclientSessionWebSocketSession.booleanbooleanReturntrueif theclientSessionis opened.booleanvoidsetAutoStartup(boolean autoStartup) voidsetConnectionTimeout(int connectionTimeout) Set the connection timeout in seconds; default: 10.voidsetHeaders(org.springframework.http.HttpHeaders headers) voidsetHeadersMap(Map<String, String> headers) voidvoidsetPhase(int phase) voidstart()voidstop()voidMethods inherited from class IntegrationWebSocketContainer
addSupportedProtocols, closeSession, destroy, getSessions, getSubProtocols, getWebSocketHandler, setMessageListener, setSendBufferOverflowStrategy, setSendBufferSizeLimit, setSendTimeLimit, setSupportedProtocols, setWebSocketHandlerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
isPauseable
-
Constructor Details
-
ClientWebSocketContainer
-
ClientWebSocketContainer
-
-
Method Details
-
setOrigin
-
setHeadersMap
-
setHeaders
public void setHeaders(org.springframework.http.HttpHeaders headers) -
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 theclientSessionWebSocketSession. Independently of provided argument, this method always returns only the establishedclientSession- Overrides:
getSessionin 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()Returntrueif theclientSessionis opened.- Returns:
- the
WebSocketSession.isOpen()state. - Since:
- 4.2.6
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceorg.springframework.context.SmartLifecycle
-
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
stop
- Specified by:
stopin interfaceorg.springframework.context.SmartLifecycle
-