Class ServerWebSocketContainer
java.lang.Object
org.springframework.integration.websocket.IntegrationWebSocketContainer
org.springframework.integration.websocket.ServerWebSocketContainer
- All Implemented Interfaces:
- DisposableBean,- Lifecycle,- Phased,- SmartLifecycle,- WebSocketConfigurer
public class ServerWebSocketContainer extends IntegrationWebSocketContainer implements WebSocketConfigurer, SmartLifecycle
The 
IntegrationWebSocketContainer implementation for the server
 WebSocketHandler registration.
 
 Registers an internal IntegrationWebSocketContainer.IntegrationWebSocketHandler
 for provided paths with the WebSocketHandlerRegistry.
 
 The real registration is based on Spring Web-Socket infrastructure via WebSocketConfigurer
 implementation of this class.
- Since:
- 4.1
- Author:
- Artem Bilan, Gary Russell
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classServerWebSocketContainer.SockJsServiceOptions
- 
Field SummaryFields inherited from class org.springframework.integration.websocket.IntegrationWebSocketContainerDEFAULT_SEND_BUFFER_SIZE, DEFAULT_SEND_TIME_LIMIT, logger, sessions
- 
Constructor SummaryConstructors Constructor Description ServerWebSocketContainer(String... paths)
- 
Method SummaryMethods inherited from class org.springframework.integration.websocket.IntegrationWebSocketContaineraddSupportedProtocols, closeSession, destroy, getSession, getSessions, getSubProtocols, getWebSocketHandler, setMessageListener, setSendBufferOverflowStrategy, setSendBufferSizeLimit, setSendTimeLimit, setSupportedProtocols, setWebSocketHandler
- 
Constructor Details
- 
Method Details- 
setHandshakeHandler
- 
setInterceptors
- 
setDecoratorFactoriespublic ServerWebSocketContainer setDecoratorFactories(WebSocketHandlerDecoratorFactory... factories)Configure one or more factories to decorate the handler used to process WebSocket messages. This may be useful in some advanced use cases, for example to allow Spring Security to forcibly close the WebSocket session when the corresponding HTTP session expires.- Parameters:
- factories- the WebSocketHandlerDecoratorFactory array to use
- Returns:
- the current ServerWebSocketContainer
- Since:
- 4.2
 
- 
setAllowedOriginsConfigure allowedOriginheader values.- Parameters:
- origins- the origins to allow.
- Returns:
- the current ServerWebSocketContainer
- Since:
- 4.3
- See Also:
- WebSocketHandlerRegistration.setAllowedOrigins(String...)
 
- 
withSockJspublic ServerWebSocketContainer withSockJs(ServerWebSocketContainer.SockJsServiceOptions... sockJsServiceOptions)
- 
setSockJsServiceOptionspublic void setSockJsServiceOptions(ServerWebSocketContainer.SockJsServiceOptions sockJsServiceOptions)
- 
setSockJsTaskSchedulerConfigure aTaskSchedulerfor SockJS fallback service. This is an alternative for default SockJS service scheduler when Websocket endpoint (this server container) is registered at runtime.- Parameters:
- sockJsTaskScheduler- the- TaskSchedulerfor SockJS fallback service.
- Since:
- 5.5.1
 
- 
getSockJsTaskScheduler
- 
registerWebSocketHandlers- Specified by:
- registerWebSocketHandlersin interface- WebSocketConfigurer
 
- 
setAutoStartuppublic void setAutoStartup(boolean autoStartup)
- 
setPhasepublic void setPhase(int phase)
- 
isAutoStartuppublic boolean isAutoStartup()- Specified by:
- isAutoStartupin interface- SmartLifecycle
 
- 
getPhasepublic int getPhase()- Specified by:
- getPhasein interface- Phased
- Specified by:
- getPhasein interface- SmartLifecycle
 
- 
isRunningpublic boolean isRunning()
- 
startpublic void start()
- 
stoppublic void stop()
- 
stop- Specified by:
- stopin interface- SmartLifecycle
 
 
-