Top Methods
jakarta.websocket

public Interface WebSocketContainer

Known Direct Subinterfaces
jakarta.websocket.server.ServerContainer
Known Direct Implementers
org.apache.tomcat.websocket.WsWebSocketContainer
Imports
java.io.IOException, java.net.URI, java.util.Set

Method Summary

Modifier and TypeMethod and Description
public Session
connectToServer(Object endpoint, URI path)

public Session
connectToServer(Class<?> annotatedEndpointClass, URI path)

public Session

Returns:

The WebSocket session for the connection
connectToServer
(Endpoint
The endpoint instance that will handle responses from the server
endpoint
,
ClientEndpointConfig
Used to configure the new connection
clientEndpointConfiguration
,
URI
The full URL of the WebSocket endpoint to connect to
path
)

Creates a new connection to the WebSocket.

public Session

Returns:

The WebSocket session for the connection
connectToServer
(Class<? extends Endpoint>
An instance of this class will be created to handle responses from the server
endpoint
,
ClientEndpointConfig
Used to configure the new connection
clientEndpointConfiguration
,
URI
The full URL of the WebSocket endpoint to connect to
path
)

Creates a new connection to the WebSocket.

public long

Returns:

The current default timeout in milliseconds. A non-positive value means an infinite timeout.
getDefaultAsyncSendTimeout
()

Get the default timeout for sending a message asynchronously.

public int

Returns:

The current default maximum buffer size in bytes
getDefaultMaxBinaryMessageBufferSize
()

Get the default maximum buffer size for binary messages.

public long

Returns:

The current default session idle timeout in milliseconds. Zero or negative values indicate an infinite timeout.
getDefaultMaxSessionIdleTimeout
()

Get the current default session idle timeout.

public int

Returns:

The current default maximum buffer size in characters
getDefaultMaxTextMessageBufferSize
()

Get the default maximum buffer size for text messages.

public Set<Extension>

Returns:

The set of extensions that are supported by this WebSocket implementation.
getInstalledExtensions
()

Get the installed extensions.

public void
setAsyncSendTimeout(long
The new default timeout in milliseconds. A non-positive value means an infinite timeout.
timeout
)

Set the default timeout for sending a message asynchronously.

public void
setDefaultMaxBinaryMessageBufferSize(int
The new default maximum buffer size in bytes
max
)

Set the default maximum buffer size for binary messages.

public void
setDefaultMaxSessionIdleTimeout(long
The new default session idle timeout in milliseconds. Zero or negative values indicate an infinite timeout.
timeout
)

Set the default session idle timeout.

public void
setDefaultMaxTextMessageBufferSize(int
The new default maximum buffer size in characters
max
)

Set the default maximum buffer size for text messages.

Method Detail

connectToServerback to summary
public Session connectToServer(Object endpoint, URI path) throws DeploymentException, IOException
connectToServerback to summary
public Session connectToServer(Class<?> annotatedEndpointClass, URI path) throws DeploymentException, IOException
connectToServerback to summary
public Session connectToServer(Endpoint endpoint, ClientEndpointConfig clientEndpointConfiguration, URI path) throws DeploymentException, IOException

Creates a new connection to the WebSocket.

Parameters
endpoint:Endpoint

The endpoint instance that will handle responses from the server

clientEndpointConfiguration:ClientEndpointConfig

Used to configure the new connection

path:URI

The full URL of the WebSocket endpoint to connect to

Returns:Session

The WebSocket session for the connection

Exceptions
DeploymentException:
If the connection cannot be established
IOException:
If an I/O occurred while trying to establish the connection
connectToServerback to summary
public Session connectToServer(Class<? extends Endpoint> endpoint, ClientEndpointConfig clientEndpointConfiguration, URI path) throws DeploymentException, IOException

Creates a new connection to the WebSocket.

Parameters
endpoint:Class<? extends Endpoint>

An instance of this class will be created to handle responses from the server

clientEndpointConfiguration:ClientEndpointConfig

Used to configure the new connection

path:URI

The full URL of the WebSocket endpoint to connect to

Returns:Session

The WebSocket session for the connection

Exceptions
DeploymentException:
If the connection cannot be established
IOException:
If an I/O occurred while trying to establish the connection
getDefaultAsyncSendTimeoutback to summary
public long getDefaultAsyncSendTimeout()

Get the default timeout for sending a message asynchronously.

Returns:long

The current default timeout in milliseconds. A non-positive value means an infinite timeout.

getDefaultMaxBinaryMessageBufferSizeback to summary
public int getDefaultMaxBinaryMessageBufferSize()

Get the default maximum buffer size for binary messages.

Returns:int

The current default maximum buffer size in bytes

getDefaultMaxSessionIdleTimeoutback to summary
public long getDefaultMaxSessionIdleTimeout()

Get the current default session idle timeout.

Returns:long

The current default session idle timeout in milliseconds. Zero or negative values indicate an infinite timeout.

getDefaultMaxTextMessageBufferSizeback to summary
public int getDefaultMaxTextMessageBufferSize()

Get the default maximum buffer size for text messages.

Returns:int

The current default maximum buffer size in characters

getInstalledExtensionsback to summary
public Set<Extension> getInstalledExtensions()

Get the installed extensions.

Returns:Set<Extension>

The set of extensions that are supported by this WebSocket implementation.

setAsyncSendTimeoutback to summary
public void setAsyncSendTimeout(long timeout)

Set the default timeout for sending a message asynchronously.

Parameters
timeout:long

The new default timeout in milliseconds. A non-positive value means an infinite timeout.

setDefaultMaxBinaryMessageBufferSizeback to summary
public void setDefaultMaxBinaryMessageBufferSize(int max)

Set the default maximum buffer size for binary messages.

Parameters
max:int

The new default maximum buffer size in bytes

setDefaultMaxSessionIdleTimeoutback to summary
public void setDefaultMaxSessionIdleTimeout(long timeout)

Set the default session idle timeout.

Parameters
timeout:long

The new default session idle timeout in milliseconds. Zero or negative values indicate an infinite timeout.

setDefaultMaxTextMessageBufferSizeback to summary
public void setDefaultMaxTextMessageBufferSize(int max)

Set the default maximum buffer size for text messages.

Parameters
max:int

The new default maximum buffer size in characters