org.springframework.web.socket.client.standard

## 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:
    `AnnotatedEndpointConnectionManager`

- - ### Field Summary

    - ### Fields inherited from class org.springframework.web.socket.client.ConnectionManagerSupport

      `logger`

    - ### Fields inherited from interface org.springframework.context.SmartLifecycle

      `DEFAULT_PHASE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EndpointConnectionManager(Class<? extends Endpoint> endpointClass, String uriTemplate, Object... uriVars)`
    `EndpointConnectionManager(Endpoint endpoint, String uriTemplate, Object... uriVariables)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `closeConnection()` Subclasses implement this to close the connection.
    `TaskExecutor` | `getTaskExecutor()` Return the configured `TaskExecutor`.
    `WebSocketContainer` | `getWebSocketContainer()`
    `boolean` | `isConnected()` Whether the connection is open/`true` or closed/`false`.
    `protected void` | `openConnection()` Subclasses implement this to actually establish the connection.
    `void` | `setBeanFactory(BeanFactory beanFactory)` Callback that supplies the owning factory to a bean instance.
    `void` | `setConfigurator(ClientEndpointConfig.Configurator configurator)`
    `void` | `setDecoders(List<Class<? extends Decoder>> decoders)`
    `void` | `setEncoders(List<Class<? extends Encoder>> encoders)`
    `void` | `setExtensions(Extension... extensions)`
    `void` | `setSupportedProtocols(String... protocols)`
    `void` | `setTaskExecutor(TaskExecutor taskExecutor)` Set a `TaskExecutor` to use to open connections.
    `void` | `setWebSocketContainer(WebSocketContainer webSocketContainer)`

    - ### Methods inherited from class org.springframework.web.socket.client.ConnectionManagerSupport

      `getPhase, getUri, isAutoStartup, isRunning, setAutoStartup, setPhase, start, startInternal, stop, stop, stopInternal`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EndpointConnectionManager

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

    - #### EndpointConnectionManager

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

  - ### Method Detail

    - #### 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(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:
        `BeanInitializationException`

    - #### 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`