public class WebSocketClient extends ContainerLifeCycle implements WebSocketContainerScope
AbstractLifeCycle.AbstractLifeCycleListenerContainer.InheritedListener, Container.ListenerLifeCycle.Listener| Constructor and Description |
|---|
WebSocketClient()
Instantiate a WebSocketClient with defaults
|
WebSocketClient(ByteBufferPool bufferPool)
Create a new WebSocketClient
|
WebSocketClient(java.util.concurrent.Executor executor)
Create a new WebSocketClient
|
WebSocketClient(HttpClient httpClient)
Instantiate a WebSocketClient using HttpClient for defaults
|
WebSocketClient(HttpClient httpClient,
DecoratedObjectFactory objectFactory)
Instantiate a WebSocketClient using HttpClient for defaults
|
WebSocketClient(SslContextFactory sslContextFactory)
Create a new WebSocketClient
|
WebSocketClient(SslContextFactory sslContextFactory,
java.util.concurrent.Executor executor)
Create a new WebSocketClient
|
WebSocketClient(SslContextFactory sslContextFactory,
java.util.concurrent.Executor executor,
ByteBufferPool bufferPool)
Create WebSocketClient using sharing instances of SSLContextFactory
Executor, and ByteBufferPool
|
WebSocketClient(WebSocketContainerScope scope)
Create WebSocketClient other Container Scope, to allow sharing of
internal features like Executor, ByteBufferPool, SSLContextFactory, etc.
|
WebSocketClient(WebSocketContainerScope scope,
EventDriverFactory eventDriverFactory,
SessionFactory sessionFactory)
Create WebSocketClient based on pre-existing Container Scope, to allow sharing of
internal features like Executor, ByteBufferPool, SSLContextFactory, etc.
|
WebSocketClient(WebSocketContainerScope scope,
EventDriverFactory eventDriverFactory,
SessionFactory sessionFactory,
HttpClient httpClient)
Create WebSocketClient based on pre-existing Container Scope, to allow sharing of
internal features like Executor, ByteBufferPool, SSLContextFactory, etc.
|
WebSocketClient(WebSocketContainerScope scope,
SslContextFactory sslContextFactory)
Create WebSocketClient other Container Scope, to allow sharing of
internal features like Executor, ByteBufferPool, SSLContextFactory, etc.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSessionListener(WebSocketSessionListener listener) |
java.util.concurrent.Future<Session> |
connect(java.lang.Object websocket,
java.net.URI toUri) |
java.util.concurrent.Future<Session> |
connect(java.lang.Object websocket,
java.net.URI toUri,
ClientUpgradeRequest request)
Connect to remote websocket endpoint
|
java.util.concurrent.Future<Session> |
connect(java.lang.Object websocket,
java.net.URI toUri,
ClientUpgradeRequest request,
UpgradeListener upgradeListener)
Connect to remote websocket endpoint
|
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
boolean |
equals(java.lang.Object o) |
long |
getAsyncWriteTimeout()
Return the number of milliseconds for a timeout of an attempted write operation.
|
java.net.SocketAddress |
getBindAddress() |
ByteBufferPool |
getBufferPool()
The configured Container Buffer Pool.
|
ConnectionManager |
getConnectionManager()
Deprecated.
|
long |
getConnectTimeout() |
java.net.CookieStore |
getCookieStore() |
EventDriverFactory |
getEventDriverFactory() |
java.util.concurrent.Executor |
getExecutor()
Executor in use by the container.
|
ExtensionFactory |
getExtensionFactory() |
HttpClient |
getHttpClient()
Get the internal
HttpClient. |
Masker |
getMasker()
Deprecated.
not used, no replacement
|
int |
getMaxBinaryMessageBufferSize()
Get the maximum size for buffering of a binary message.
|
long |
getMaxBinaryMessageSize()
Get the maximum size for a binary message.
|
long |
getMaxIdleTimeout()
Get the max idle timeout for new connections.
|
int |
getMaxTextMessageBufferSize()
Get the maximum size for buffering of a text message.
|
long |
getMaxTextMessageSize()
Get the maximum size for a text message.
|
DecoratedObjectFactory |
getObjectFactory()
Object Factory used to create objects.
|
java.util.Set<WebSocketSession> |
getOpenSessions() |
WebSocketPolicy |
getPolicy()
The policy the container is running on.
|
Scheduler |
getScheduler() |
SessionFactory |
getSessionFactory() |
java.util.Collection<WebSocketSessionListener> |
getSessionListeners() |
SslContextFactory |
getSslContextFactory()
Get the in use
SslContextFactory |
int |
hashCode() |
boolean |
isDispatchIO()
Deprecated.
|
boolean |
isStopAtShutdown() |
protected ConnectionManager |
newConnectionManager()
Deprecated.
has no replacement
|
void |
removeSessionListener(WebSocketSessionListener listener) |
void |
setAsyncWriteTimeout(long ms) |
void |
setBindAdddress(java.net.SocketAddress bindAddress)
Deprecated.
(this is a bad bad bad typo, it has 3
"d" characters in a row) use HttpClient.setBindAddress(SocketAddress)
to the internal WebSocketClient(HttpClient) |
void |
setBindAddress(java.net.SocketAddress bindAddress)
Sets the Bind Address on the internal
HttpClient. |
void |
setBufferPool(ByteBufferPool bufferPool)
Set's the Bind Address on the internal
HttpClient. |
void |
setConnectTimeout(long ms)
Set the timeout for connecting to the remote server on the internal
HttpClient |
void |
setCookieStore(java.net.CookieStore cookieStore)
Set the
CookieStore to use on the internal HttpClient |
void |
setDaemon(boolean daemon)
Deprecated.
not used, configure threading in
HttpClient instead |
void |
setDispatchIO(boolean dispatchIO)
Deprecated.
no longer used, this has no replacement
|
void |
setExecutor(java.util.concurrent.Executor executor)
Sets the Executor in use on the internal
HttpClient |
void |
setMasker(Masker masker)
Deprecated.
not used, no replacement
|
void |
setMaxBinaryMessageBufferSize(int max) |
void |
setMaxIdleTimeout(long ms)
Set the max idle timeout for new connections.
|
void |
setMaxTextMessageBufferSize(int max) |
void |
setStopAtShutdown(boolean stop)
Set JVM shutdown behavior.
|
java.lang.String |
toString() |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, finalize, getClass, notify, notifyAll, wait, wait, waitisRunningdumpObjects, dumpSelfpublic WebSocketClient()
public WebSocketClient(HttpClient httpClient)
httpClient - the HttpClient to base internal defaults off ofpublic WebSocketClient(HttpClient httpClient, DecoratedObjectFactory objectFactory)
httpClient - the HttpClient to base internal defaults off ofobjectFactory - the DecoratedObjectFactory for all client instantiated classespublic WebSocketClient(SslContextFactory sslContextFactory)
sslContextFactory - ssl context factory to use on the internal HttpClientpublic WebSocketClient(java.util.concurrent.Executor executor)
executor - the executor to use on the internal HttpClientpublic WebSocketClient(ByteBufferPool bufferPool)
bufferPool - byte buffer pool to use on the internal HttpClientpublic WebSocketClient(SslContextFactory sslContextFactory, java.util.concurrent.Executor executor)
sslContextFactory - ssl context factory to use on the internal HttpClientexecutor - the executor to use on the internal HttpClientpublic WebSocketClient(WebSocketContainerScope scope)
scope - the Container Scopepublic WebSocketClient(WebSocketContainerScope scope, SslContextFactory sslContextFactory)
scope - the Container ScopesslContextFactory - SSL ContextFactory to use in preference to one from
WebSocketContainerScope.getSslContextFactory()public WebSocketClient(SslContextFactory sslContextFactory, java.util.concurrent.Executor executor, ByteBufferPool bufferPool)
sslContextFactory - shared SSL ContextFactoryexecutor - shared ExecutorbufferPool - shared ByteBufferPoolpublic WebSocketClient(WebSocketContainerScope scope, EventDriverFactory eventDriverFactory, SessionFactory sessionFactory)
scope - the Container ScopeeventDriverFactory - the EventDriver Factory to usesessionFactory - the SessionFactory to usepublic WebSocketClient(WebSocketContainerScope scope, EventDriverFactory eventDriverFactory, SessionFactory sessionFactory, HttpClient httpClient)
scope - the Container ScopeeventDriverFactory - the EventDriver Factory to usesessionFactory - the SessionFactory to usehttpClient - the httpClient to usepublic java.util.concurrent.Future<Session> connect(java.lang.Object websocket, java.net.URI toUri) throws java.io.IOException
java.io.IOExceptionpublic java.util.concurrent.Future<Session> connect(java.lang.Object websocket, java.net.URI toUri, ClientUpgradeRequest request) throws java.io.IOException
websocket - the websocket objecttoUri - the websocket uri to connect torequest - the upgrade request informationjava.io.IOException - if unable to connectpublic java.util.concurrent.Future<Session> connect(java.lang.Object websocket, java.net.URI toUri, ClientUpgradeRequest request, UpgradeListener upgradeListener) throws java.io.IOException
websocket - the websocket objecttoUri - the websocket uri to connect torequest - the upgrade request informationupgradeListener - the upgrade listenerjava.io.IOException - if unable to connectprotected void doStart()
throws java.lang.Exception
ContainerLifeCycledoStart in class ContainerLifeCyclejava.lang.Exceptionprotected void doStop()
throws java.lang.Exception
ContainerLifeCycledoStop in class ContainerLifeCyclejava.lang.Exception@Deprecated public boolean isDispatchIO()
public long getAsyncWriteTimeout()
public java.net.SocketAddress getBindAddress()
public ByteBufferPool getBufferPool()
WebSocketContainerScopegetBufferPool in interface WebSocketContainerScope@Deprecated public ConnectionManager getConnectionManager()
public long getConnectTimeout()
public java.net.CookieStore getCookieStore()
public EventDriverFactory getEventDriverFactory()
public java.util.concurrent.Executor getExecutor()
WebSocketContainerScopegetExecutor in interface WebSocketContainerScopepublic ExtensionFactory getExtensionFactory()
@Deprecated public Masker getMasker()
RandomMasker instancepublic int getMaxBinaryMessageBufferSize()
public long getMaxBinaryMessageSize()
public long getMaxIdleTimeout()
public int getMaxTextMessageBufferSize()
public long getMaxTextMessageSize()
public DecoratedObjectFactory getObjectFactory()
WebSocketContainerScopegetObjectFactory in interface WebSocketContainerScopepublic java.util.Set<WebSocketSession> getOpenSessions()
public WebSocketPolicy getPolicy()
WebSocketContainerScopegetPolicy in interface WebSocketContainerScopepublic Scheduler getScheduler()
public SessionFactory getSessionFactory()
public SslContextFactory getSslContextFactory()
SslContextFactorygetSslContextFactory in interface WebSocketContainerScopeSslContextFactory that manages TLS encryption on the internal HttpClientWebSocketClient(SslContextFactory)public void addSessionListener(WebSocketSessionListener listener)
addSessionListener in interface WebSocketContainerScopepublic void removeSessionListener(WebSocketSessionListener listener)
removeSessionListener in interface WebSocketContainerScopepublic java.util.Collection<WebSocketSessionListener> getSessionListeners()
getSessionListeners in interface WebSocketContainerScope@Deprecated protected ConnectionManager newConnectionManager()
public void setAsyncWriteTimeout(long ms)
@Deprecated public void setBindAdddress(java.net.SocketAddress bindAddress)
"d" characters in a row) use HttpClient.setBindAddress(SocketAddress)
to the internal WebSocketClient(HttpClient)bindAddress - the address to bind to the internal HttpClientpublic void setBindAddress(java.net.SocketAddress bindAddress)
HttpClient.bindAddress - the local bind address for the internal HttpClientpublic void setBufferPool(ByteBufferPool bufferPool)
HttpClient.bufferPool - The buffer poolpublic void setConnectTimeout(long ms)
HttpClientms - the timeout in millisecondspublic void setCookieStore(java.net.CookieStore cookieStore)
CookieStore to use on the internal HttpClientcookieStore - The cookie store@Deprecated public void setDaemon(boolean daemon)
HttpClient insteaddaemon - do nothing@Deprecated public void setDispatchIO(boolean dispatchIO)
dispatchIO - true to have IO operations be dispatched to Executorpublic void setExecutor(java.util.concurrent.Executor executor)
HttpClientexecutor - The executor to use@Deprecated public void setMasker(Masker masker)
masker - does nothingpublic void setMaxBinaryMessageBufferSize(int max)
public void setMaxIdleTimeout(long ms)
Existing connections will not have their max idle timeout adjusted.
ms - the timeout in millisecondspublic void setMaxTextMessageBufferSize(int max)
public HttpClient getHttpClient()
HttpClient.
Note: this can result in a LinkageError if used within a WebApp that runs
on a server that also has HttpClient on the server classpath.
HttpClientpublic void setStopAtShutdown(boolean stop)
stop - If true, this client instance will be explicitly stopped when the
JVM is shutdown. Otherwise the application is responsible for maintaining the WebSocketClient lifecycle.Runtime.addShutdownHook(Thread),
ShutdownThreadpublic boolean isStopAtShutdown()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class AbstractLifeCycleCopyright © 1995–2021 Webtide. All rights reserved.