WebSocketContainer (WebSocket 2.2 API Documentation - Apache Tomcat 11.0.6)
Description: declaration: package: jakarta.websocket, interface: WebSocketContainer

# Interface WebSocketContainer

All Known Subinterfaces:
  `ServerContainer`

public interface WebSocketContainer

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Session`
  `connectToServer(Endpoint endpoint, ClientEndpointConfig clientEndpointConfiguration, URI path)`
  Creates a new connection to the WebSocket.
  `Session`
  `connectToServer(Class<?> annotatedEndpointClass, URI path)`
  `Session`
  `connectToServer(Class<? extends Endpoint> endpoint, ClientEndpointConfig clientEndpointConfiguration, URI path)`
  Creates a new connection to the WebSocket.
  `Session`
  `connectToServer(Object endpoint, URI path)`
  `long`
  `getDefaultAsyncSendTimeout()`
  Get the default timeout for sending a message asynchronously.
  `int`
  `getDefaultMaxBinaryMessageBufferSize()`
  Get the default maximum buffer size for binary messages.
  `long`
  `getDefaultMaxSessionIdleTimeout()`
  Get the current default session idle timeout.
  `int`
  `getDefaultMaxTextMessageBufferSize()`
  Get the default maximum buffer size for text messages.
  `Set<Extension>`
  `getInstalledExtensions()`
  Get the installed extensions.
  `void`
  `setAsyncSendTimeout(long timeout)`
  Set the default timeout for sending a message asynchronously.
  `void`
  `setDefaultMaxBinaryMessageBufferSize(int max)`
  Set the default maximum buffer size for binary messages.
  `void`
  `setDefaultMaxSessionIdleTimeout(long timeout)`
  Set the default session idle timeout.
  `void`
  `setDefaultMaxTextMessageBufferSize(int max)`
  Set the default maximum buffer size for text messages.

- ## Method Details

  - ### getDefaultAsyncSendTimeout

    long getDefaultAsyncSendTimeout()
    Get the default timeout for sending a message asynchronously.
    Returns:
      The current default timeout in milliseconds. A non-positive value means an infinite timeout.

  - ### setAsyncSendTimeout

    void setAsyncSendTimeout(long timeout)
    Set the default timeout for sending a message asynchronously.
    Parameters:
      `timeout` - The new default timeout in milliseconds. A non-positive value means an infinite timeout.

  - ### connectToServer

    Session connectToServer(Object endpoint, URI path) throws DeploymentException, IOException
    Throws:
      `DeploymentException`
      `IOException`

  - ### connectToServer

    Session connectToServer(Class<?> annotatedEndpointClass, URI path) throws DeploymentException, IOException
    Throws:
      `DeploymentException`
      `IOException`

  - ### connectToServer

    Session connectToServer(Endpoint endpoint, ClientEndpointConfig clientEndpointConfiguration, URI path) throws DeploymentException, IOException
    Creates a new connection to the WebSocket.
    Parameters:
      `endpoint` - The endpoint instance that will handle responses from the server
      `clientEndpointConfiguration` - Used to configure the new connection
      `path` - The full URL of the WebSocket endpoint to connect to
    Returns:
      The WebSocket session for the connection
    Throws:
      `DeploymentException` - If the connection cannot be established
      `IOException` - If an I/O occurred while trying to establish the connection

  - ### connectToServer

    Session connectToServer(Class<? extends Endpoint> endpoint, ClientEndpointConfig clientEndpointConfiguration, URI path) throws DeploymentException, IOException
    Creates a new connection to the WebSocket.
    Parameters:
      `endpoint` - An instance of this class will be created to handle responses from the server
      `clientEndpointConfiguration` - Used to configure the new connection
      `path` - The full URL of the WebSocket endpoint to connect to
    Returns:
      The WebSocket session for the connection
    Throws:
      `DeploymentException` - If the connection cannot be established
      `IOException` - If an I/O occurred while trying to establish the connection

  - ### getDefaultMaxSessionIdleTimeout

    long getDefaultMaxSessionIdleTimeout()
    Get the current default session idle timeout.
    Returns:
      The current default session idle timeout in milliseconds. Zero or negative values indicate an infinite timeout.

  - ### setDefaultMaxSessionIdleTimeout

    void setDefaultMaxSessionIdleTimeout(long timeout)
    Set the default session idle timeout.
    Parameters:
      `timeout` - The new default session idle timeout in milliseconds. Zero or negative values indicate an infinite timeout.

  - ### getDefaultMaxBinaryMessageBufferSize

    int getDefaultMaxBinaryMessageBufferSize()
    Get the default maximum buffer size for binary messages.
    Returns:
      The current default maximum buffer size in bytes

  - ### setDefaultMaxBinaryMessageBufferSize

    void setDefaultMaxBinaryMessageBufferSize(int max)
    Set the default maximum buffer size for binary messages.
    Parameters:
      `max` - The new default maximum buffer size in bytes

  - ### getDefaultMaxTextMessageBufferSize

    int getDefaultMaxTextMessageBufferSize()
    Get the default maximum buffer size for text messages.
    Returns:
      The current default maximum buffer size in characters

  - ### setDefaultMaxTextMessageBufferSize

    void setDefaultMaxTextMessageBufferSize(int max)
    Set the default maximum buffer size for text messages.
    Parameters:
      `max` - The new default maximum buffer size in characters

  - ### getInstalledExtensions

    Set<Extension> getInstalledExtensions()
    Get the installed extensions.
    Returns:
      The set of extensions that are supported by this WebSocket implementation.