Class EndpointConnectionManager

java.lang.Object
org.springframework.web.socket.client.ConnectionManagerSupport
org.springframework.web.socket.client.standard.EndpointConnectionManager
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

public class EndpointConnectionManager extends ConnectionManagerSupport implements org.springframework.beans.factory.BeanFactoryAware
A WebSocket connection manager that is given a URI, an Endpoint, connects to a WebSocket server through the 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.
Since:
4.0
Author:
Rossen Stoyanchev
See Also:
  • Constructor Details

    • EndpointConnectionManager

      public EndpointConnectionManager(Endpoint endpoint, String uriTemplate, Object... uriVariables)
    • EndpointConnectionManager

      public EndpointConnectionManager(Class<? extends Endpoint> endpointClass, String uriTemplate, Object... uriVars)
  • Method Details

    • setSupportedProtocols

      public void setSupportedProtocols(String... protocols)
    • setExtensions

      public void setExtensions(Extension... extensions)
    • setEncoders

      public void setEncoders(List<Class<? extends Encoder>> encoders)
    • setDecoders

      public void setDecoders(List<Class<? extends Decoder>> decoders)
    • setConfigurator

      public void setConfigurator(ClientEndpointConfig.Configurator configurator)
    • setWebSocketContainer

      public void setWebSocketContainer(WebSocketContainer webSocketContainer)
    • getWebSocketContainer

      public WebSocketContainer getWebSocketContainer()
    • setBeanFactory

      public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
    • setTaskExecutor

      public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
      Set a TaskExecutor to use to open connections. By default SimpleAsyncTaskExecutor is used.
    • getTaskExecutor

      public org.springframework.core.task.TaskExecutor getTaskExecutor()
      Return the configured TaskExecutor.
    • openConnection

      protected void openConnection()
      Specified by:
      openConnection in class ConnectionManagerSupport
    • closeConnection

      protected void closeConnection() throws Exception
      Specified by:
      closeConnection in class ConnectionManagerSupport
      Throws:
      Exception
    • isConnected

      protected boolean isConnected()
      Specified by:
      isConnected in class ConnectionManagerSupport