public interface WebSocketContainer
A WebSocketContainer may be accessed by concurrent threads, so implementations must ensure the integrity of its mutable attributes in such circumstances.
Modifier and Type | Method and Description |
---|---|
Session |
connectToServer(java.lang.Class<?> annotatedEndpointClass,
java.net.URI path)
Connect the supplied annotated endpoint to its server.
|
Session |
connectToServer(java.lang.Class<? extends Endpoint> endpointClass,
ClientEndpointConfig cec,
java.net.URI path)
Connect the supplied programmatic endpoint to its server with the given configuration.
|
Session |
connectToServer(Endpoint endpointInstance,
ClientEndpointConfig cec,
java.net.URI path)
Connect the supplied programmatic client endpoint instance to its server with the given configuration.
|
Session |
connectToServer(java.lang.Object annotatedEndpointInstance,
java.net.URI path)
Connect the supplied annotated endpoint instance to its server.
|
long |
getDefaultAsyncSendTimeout()
Return the number of milliseconds the implementation will timeout attempting to send a websocket message for all
RemoteEndpoints associated with this container.
|
int |
getDefaultMaxBinaryMessageBufferSize()
Returns the default maximum size of incoming binary message that this container will buffer.
|
long |
getDefaultMaxSessionIdleTimeout()
Return the default time in milliseconds after which any web socket sessions in this container will be closed if
it has been inactive.
|
int |
getDefaultMaxTextMessageBufferSize()
Returns the default maximum size of incoming text message that this container will buffer.
|
java.util.Set<Extension> |
getInstalledExtensions()
Return the set of Extensions installed in the container.
|
void |
setAsyncSendTimeout(long timeoutmillis)
Sets the number of milliseconds the implementation will timeout attempting to send a websocket message for all
RemoteEndpoints associated with this container.
|
void |
setDefaultMaxBinaryMessageBufferSize(int max)
Sets the default maximum size of incoming binary message that this container will buffer.
|
void |
setDefaultMaxSessionIdleTimeout(long timeout)
Sets the default time in milliseconds after which any web socket sessions in this container will be closed if it
has been inactive.
|
void |
setDefaultMaxTextMessageBufferSize(int max)
Sets the maximum size of incoming text message that this container will buffer.
|
long getDefaultAsyncSendTimeout()
void setAsyncSendTimeout(long timeoutmillis)
timeoutmillis
- the timeout in milliseconds; use zero or negative value for no timeoutSession connectToServer(java.lang.Object annotatedEndpointInstance, java.net.URI path) throws DeploymentException, java.io.IOException
ClientEndpoint
annotation. This method blocks until the
connection is established, or throws an error if either the connection could not be made or there was a problem
with the supplied endpoint class. If the developer uses this method to deploy the client endpoint, services like
dependency injection that are supported, for example, when the implementation is part of the Java EE platform may
not be available. If the client endpoint uses dependency injection, use
connectToServer(java.lang.Class, java.net.URI)
instead.annotatedEndpointInstance
- the annotated websocket client endpoint instance.path
- the complete path to the server endpoint.DeploymentException
- if the annotated endpoint instance is not valid.java.io.IOException
- if there was a network or protocol problem that prevented the client endpoint being
connected to its server.java.lang.IllegalStateException
- if called during the deployment phase of the containing application.Session connectToServer(java.lang.Class<?> annotatedEndpointClass, java.net.URI path) throws DeploymentException, java.io.IOException
ClientEndpoint
annotation. This method blocks until the connection is
established, or throws an error if either the connection could not be made or there was a problem with the
supplied endpoint class.annotatedEndpointClass
- the annotated websocket client endpoint.path
- the complete path to the server endpoint.DeploymentException
- if the class is not a valid annotated endpoint class.java.io.IOException
- if there was a network or protocol problem that prevented the client endpoint being
connected to its server.java.lang.IllegalStateException
- if called during the deployment phase of the containing application.Session connectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, java.net.URI path) throws DeploymentException, java.io.IOException
connectToServer(java.lang.Class, jakarta.websocket.ClientEndpointConfig, java.net.URI)
instead.endpointInstance
- the programmatic client endpoint instance Endpoint
.path
- the complete path to the server endpoint.cec
- the configuration used to configure the programmatic endpoint.DeploymentException
- if the configuration is not validjava.io.IOException
- if there was a network or protocol problem that prevented the client endpoint being
connected to its serverjava.lang.IllegalStateException
- if called during the deployment phase of the containing application.Session connectToServer(java.lang.Class<? extends Endpoint> endpointClass, ClientEndpointConfig cec, java.net.URI path) throws DeploymentException, java.io.IOException
endpointClass
- the programmatic client endpoint class Endpoint
.path
- the complete path to the server endpoint.cec
- the configuration used to configure the programmatic endpoint.DeploymentException
- if the configuration is not validjava.io.IOException
- if there was a network or protocol problem that prevented the client endpoint being
connected to its serverjava.lang.IllegalStateException
- if called during the deployment phase of the containing application.long getDefaultMaxSessionIdleTimeout()
Session.setMaxIdleTimeout(long)
void setDefaultMaxSessionIdleTimeout(long timeout)
Session.setMaxIdleTimeout(long)
timeout
- the maximum time in milliseconds; use zero or negative value for no timeoutint getDefaultMaxBinaryMessageBufferSize()
Session.setMaxBinaryMessageBufferSize(int)
void setDefaultMaxBinaryMessageBufferSize(int max)
max
- the maximum size of binary message in number of bytes.int getDefaultMaxTextMessageBufferSize()
Session.setMaxTextMessageBufferSize(int)
void setDefaultMaxTextMessageBufferSize(int max)
max
- the maximum size of text message in number of bytes.java.util.Set<Extension> getInstalledExtensions()