public class WsWebSocketContainer extends Object implements WebSocketContainer, BackgroundProcess
Constructor and Description |
---|
WsWebSocketContainer() |
Modifier and Type | Method and Description |
---|---|
void |
backgroundProcess() |
Session |
connectToServer(Class<?> annotatedEndpointClass,
URI path) |
Session |
connectToServer(Class<? extends Endpoint> clazz,
ClientEndpointConfig clientEndpointConfiguration,
URI path)
Creates a new connection to the WebSocket.
|
Session |
connectToServer(Endpoint endpoint,
ClientEndpointConfig clientEndpointConfiguration,
URI path)
Creates a new connection to the WebSocket.
|
Session |
connectToServer(Object pojo,
URI path) |
void |
destroy()
Cleans up the resources still in use by WebSocket sessions created from
this container.
|
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.
|
int |
getProcessPeriod()
The default value is 10 which means session expirations are processed
every 10 seconds.
|
protected void |
registerSession(Endpoint endpoint,
WsSession wsSession) |
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.
|
protected void |
setInstanceManager(InstanceManager instanceManager) |
void |
setProcessPeriod(int period) |
protected void |
unregisterSession(Endpoint endpoint,
WsSession wsSession) |
protected void setInstanceManager(InstanceManager instanceManager)
public Session connectToServer(Object pojo, URI path) throws DeploymentException
connectToServer
in interface WebSocketContainer
DeploymentException
public Session connectToServer(Class<?> annotatedEndpointClass, URI path) throws DeploymentException
connectToServer
in interface WebSocketContainer
DeploymentException
public Session connectToServer(Class<? extends Endpoint> clazz, ClientEndpointConfig clientEndpointConfiguration, URI path) throws DeploymentException
javax.websocket.WebSocketContainer
connectToServer
in interface WebSocketContainer
clazz
- An instance of this class will be created to handle responses
from the serverclientEndpointConfiguration
- Used to configure the new connectionpath
- The full URL of the WebSocket endpoint to connect toDeploymentException
- If the connection cannot be establishedpublic Session connectToServer(Endpoint endpoint, ClientEndpointConfig clientEndpointConfiguration, URI path) throws DeploymentException
javax.websocket.WebSocketContainer
connectToServer
in interface WebSocketContainer
endpoint
- The endpoint instance that will handle responses from the
serverclientEndpointConfiguration
- Used to configure the new connectionpath
- The full URL of the WebSocket endpoint to connect toDeploymentException
- If the connection cannot be establishedpublic long getDefaultMaxSessionIdleTimeout()
javax.websocket.WebSocketContainer
getDefaultMaxSessionIdleTimeout
in interface WebSocketContainer
public void setDefaultMaxSessionIdleTimeout(long timeout)
javax.websocket.WebSocketContainer
setDefaultMaxSessionIdleTimeout
in interface WebSocketContainer
timeout
- The new default session idle timeout in milliseconds. Zero
or negative values indicate an infinite timeout.public int getDefaultMaxBinaryMessageBufferSize()
javax.websocket.WebSocketContainer
getDefaultMaxBinaryMessageBufferSize
in interface WebSocketContainer
public void setDefaultMaxBinaryMessageBufferSize(int max)
javax.websocket.WebSocketContainer
setDefaultMaxBinaryMessageBufferSize
in interface WebSocketContainer
max
- The new default maximum buffer size in bytespublic int getDefaultMaxTextMessageBufferSize()
javax.websocket.WebSocketContainer
getDefaultMaxTextMessageBufferSize
in interface WebSocketContainer
public void setDefaultMaxTextMessageBufferSize(int max)
javax.websocket.WebSocketContainer
setDefaultMaxTextMessageBufferSize
in interface WebSocketContainer
max
- The new default maximum buffer size in characterspublic Set<Extension> getInstalledExtensions()
getInstalledExtensions
in interface WebSocketContainer
public long getDefaultAsyncSendTimeout()
getDefaultAsyncSendTimeout
in interface WebSocketContainer
public void setAsyncSendTimeout(long timeout)
setAsyncSendTimeout
in interface WebSocketContainer
timeout
- The new default timeout in milliseconds. A non-positive
value means an infinite timeout.public void destroy()
Future
s associated with blocking read/writes.public void backgroundProcess()
backgroundProcess
in interface BackgroundProcess
public void setProcessPeriod(int period)
setProcessPeriod
in interface BackgroundProcess
public int getProcessPeriod()
getProcessPeriod
in interface BackgroundProcess
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.