public class WebSocketConnectionManager extends ConnectionManagerSupport
WebSocketClient, and a
WebSocketHandler, connects to a WebSocket server through ConnectionManagerSupport.start() and
ConnectionManagerSupport.stop() methods. If ConnectionManagerSupport.setAutoStartup(boolean) is set to true
this will be done automatically when the Spring ApplicationContext is refreshed.| Modifier and Type | Field and Description |
|---|---|
private WebSocketClient |
client |
private WebSocketHttpHeaders |
headers |
private WebSocketHandler |
webSocketHandler |
private WebSocketSession |
webSocketSession |
logger| Constructor and Description |
|---|
WebSocketConnectionManager(WebSocketClient client,
WebSocketHandler webSocketHandler,
java.lang.String uriTemplate,
java.lang.Object... uriVariables) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeConnection() |
protected WebSocketHandler |
decorateWebSocketHandler(WebSocketHandler handler)
Decorate the WebSocketHandler provided to the class constructor.
|
HttpHeaders |
getHeaders()
Return the default headers for the WebSocket handshake request.
|
java.lang.String |
getOrigin() |
java.util.List<java.lang.String> |
getSubProtocols()
Return the configured sub-protocols to use.
|
protected boolean |
isConnected() |
protected void |
openConnection() |
void |
setHeaders(HttpHeaders headers)
Provide default headers to add to the WebSocket handshake request.
|
void |
setOrigin(java.lang.String origin)
Set the origin to use.
|
void |
setSubProtocols(java.util.List<java.lang.String> protocols)
Set the sub-protocols to use.
|
void |
startInternal() |
void |
stopInternal() |
getPhase, getUri, isAutoStartup, isRunning, setAutoStartup, setPhase, start, stop, stopprivate final WebSocketClient client
private final WebSocketHandler webSocketHandler
private WebSocketSession webSocketSession
private WebSocketHttpHeaders headers
public WebSocketConnectionManager(WebSocketClient client, WebSocketHandler webSocketHandler, java.lang.String uriTemplate, java.lang.Object... uriVariables)
protected WebSocketHandler decorateWebSocketHandler(WebSocketHandler handler)
By default LoggingWebSocketHandlerDecorator is added.
public void setSubProtocols(java.util.List<java.lang.String> protocols)
Sec-WebSocket-Protocol header. The
resulting WebSocket session will contain the protocol accepted by the server, if
any.public java.util.List<java.lang.String> getSubProtocols()
public void setOrigin(java.lang.String origin)
public java.lang.String getOrigin()
public void setHeaders(HttpHeaders headers)
public HttpHeaders getHeaders()
public void startInternal()
startInternal in class ConnectionManagerSupportpublic void stopInternal()
throws java.lang.Exception
stopInternal in class ConnectionManagerSupportjava.lang.Exceptionprotected void openConnection()
openConnection in class ConnectionManagerSupportprotected void closeConnection()
throws java.lang.Exception
closeConnection in class ConnectionManagerSupportjava.lang.Exceptionprotected boolean isConnected()
isConnected in class ConnectionManagerSupport