Class EndpointConnectionManager

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

public class EndpointConnectionManager extends ConnectionManagerSupport implements BeanFactoryAware
WebSocket connection manager that connects to the server via WebSocketContainer and handles the session with an Endpoint.
Since:
4.0
Author:
Rossen Stoyanchev
See Also:
  • Constructor Details

    • EndpointConnectionManager

      public EndpointConnectionManager(jakarta.websocket.Endpoint endpoint, String uriTemplate, @Nullable Object... uriVariables)
    • EndpointConnectionManager

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

    • setSupportedProtocols

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

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

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

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

      public void setConfigurator(jakarta.websocket.ClientEndpointConfig.Configurator configurator)
    • setWebSocketContainer

      public void setWebSocketContainer(jakarta.websocket.WebSocketContainer webSocketContainer)
    • getWebSocketContainer

      public jakarta.websocket.WebSocketContainer getWebSocketContainer()
    • setBeanFactory

      public void setBeanFactory(BeanFactory beanFactory)
      Description copied from interface: BeanFactoryAware
      Callback that supplies the owning factory to a bean instance.

      Invoked after the population of normal bean properties but before an initialization callback such as InitializingBean.afterPropertiesSet() or a custom init-method.

      Specified by:
      setBeanFactory in interface BeanFactoryAware
      Parameters:
      beanFactory - owning BeanFactory (never null). The bean can immediately call methods on the factory.
      See Also:
    • setTaskExecutor

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

      public TaskExecutor getTaskExecutor()
      Return the configured TaskExecutor.
    • isConnected

      public boolean isConnected()
      Description copied from class: ConnectionManagerSupport
      Whether the connection is open/true or closed/false.
      Specified by:
      isConnected in class ConnectionManagerSupport
    • openConnection

      protected void openConnection()
      Description copied from class: ConnectionManagerSupport
      Subclasses implement this to actually establish the connection.
      Specified by:
      openConnection in class ConnectionManagerSupport
    • closeConnection

      protected void closeConnection() throws Exception
      Description copied from class: ConnectionManagerSupport
      Subclasses implement this to close the connection.
      Specified by:
      closeConnection in class ConnectionManagerSupport
      Throws:
      Exception