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 java.util.List<java.lang.String> |
subProtocols |
private boolean |
syncClientLifecycle |
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.
|
java.util.List<java.lang.String> |
getSubProtocols() |
protected boolean |
isConnected() |
protected void |
openConnection() |
void |
setSubProtocols(java.util.List<java.lang.String> subProtocols) |
void |
startInternal() |
void |
stopInternal() |
getPhase, getUri, isAutoStartup, isRunning, setAutoStartup, setPhase, start, stop, stop
private final WebSocketClient client
private final WebSocketHandler webSocketHandler
private WebSocketSession webSocketSession
private final java.util.List<java.lang.String> subProtocols
private final boolean syncClientLifecycle
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> subProtocols)
public java.util.List<java.lang.String> getSubProtocols()
public void startInternal()
startInternal
in class ConnectionManagerSupport
public void stopInternal() throws java.lang.Exception
stopInternal
in class ConnectionManagerSupport
java.lang.Exception
protected void openConnection() throws java.lang.Exception
openConnection
in class ConnectionManagerSupport
java.lang.Exception
protected void closeConnection() throws java.lang.Exception
closeConnection
in class ConnectionManagerSupport
java.lang.Exception
protected boolean isConnected()
isConnected
in class ConnectionManagerSupport