Class WebSocketConnectionManager
java.lang.Object
org.springframework.web.socket.client.ConnectionManagerSupport
org.springframework.web.socket.client.WebSocketConnectionManager
- All Implemented Interfaces:
- Lifecycle,- Phased,- SmartLifecycle
WebSocket 
connection manager that connects
 to the server via WebSocketClient and handles the session with a
 WebSocketHandler.- Since:
- 4.0
- Author:
- Rossen Stoyanchev, Sam Brannen
- 
Field SummaryFields inherited from class org.springframework.web.socket.client.ConnectionManagerSupportloggerFields inherited from interface org.springframework.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructorsConstructorDescriptionWebSocketConnectionManager(WebSocketClient client, WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVariables) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidSubclasses implement this to close the connection.protected WebSocketHandlerdecorateWebSocketHandler(WebSocketHandler handler) Decorate the WebSocketHandler provided to the class constructor.Return the default headers for the WebSocket handshake request.Return the configured origin.Return the configured sub-protocols to use.booleanWhether the connection is open/trueor closed/false.protected voidSubclasses implement this to actually establish the connection.voidsetHeaders(HttpHeaders headers) Provide default headers to add to the WebSocket handshake request.voidSet the origin to use.voidsetSubProtocols(List<String> protocols) Set the sub-protocols to use.voidvoidMethods inherited from class org.springframework.web.socket.client.ConnectionManagerSupportgetPhase, getUri, isAutoStartup, isRunning, setAutoStartup, setPhase, start, stop, stop
- 
Constructor Details- 
WebSocketConnectionManagerpublic WebSocketConnectionManager(WebSocketClient client, WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVariables) 
 
- 
- 
Method Details- 
setSubProtocolsSet the sub-protocols to use. If configured, specified sub-protocols will be requested in the handshake through theSec-WebSocket-Protocolheader. The resulting WebSocket session will contain the protocol accepted by the server, if any.
- 
getSubProtocolsReturn the configured sub-protocols to use.
- 
setOriginSet the origin to use.
- 
getOriginReturn the configured origin.
- 
setHeadersProvide default headers to add to the WebSocket handshake request.
- 
getHeadersReturn the default headers for the WebSocket handshake request.
- 
startInternalpublic void startInternal()- Overrides:
- startInternalin class- ConnectionManagerSupport
 
- 
stopInternal- Overrides:
- stopInternalin class- ConnectionManagerSupport
- Throws:
- Exception
 
- 
isConnectedpublic boolean isConnected()Description copied from class:ConnectionManagerSupportWhether the connection is open/trueor closed/false.- Specified by:
- isConnectedin class- ConnectionManagerSupport
 
- 
openConnectionprotected void openConnection()Description copied from class:ConnectionManagerSupportSubclasses implement this to actually establish the connection.- Specified by:
- openConnectionin class- ConnectionManagerSupport
 
- 
closeConnectionDescription copied from class:ConnectionManagerSupportSubclasses implement this to close the connection.- Specified by:
- closeConnectionin class- ConnectionManagerSupport
- Throws:
- Exception
 
- 
decorateWebSocketHandlerDecorate the WebSocketHandler provided to the class constructor.By default LoggingWebSocketHandlerDecoratoris added.
 
-