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)
Deprecated.
use
WebSocketClient(HttpClient) instead |
WebSocketClient(Executor executor)
Deprecated.
use
WebSocketClient(HttpClient) instead |
WebSocketClient(HttpClient httpClient)
Instantiate a WebSocketClient using provided HttpClient.
|
WebSocketClient(HttpClient httpClient,
DecoratedObjectFactory decoratedObjectFactory)
Instantiate a WebSocketClient using HttpClient for defaults
|
WebSocketClient(SslContextFactory sslContextFactory)
Deprecated.
use
WebSocketClient(HttpClient) instead |
WebSocketClient(SslContextFactory sslContextFactory,
Executor executor)
Deprecated.
use
WebSocketClient(HttpClient) instead |
WebSocketClient(SslContextFactory sslContextFactory,
Executor executor,
ByteBufferPool bufferPool)
Deprecated.
use
WebSocketClient(HttpClient) instead |
WebSocketClient(WebSocketContainerScope scope)
Deprecated.
use
WebSocketClient(HttpClient) instead |
WebSocketClient(WebSocketContainerScope scope,
EventDriverFactory eventDriverFactory,
SessionFactory sessionFactory)
Deprecated.
|
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)
Deprecated.
use
WebSocketClient(HttpClient) instead |
| Modifier and Type | Method and Description |
|---|---|
void |
addSessionListener(WebSocketSessionListener listener) |
Future<Session> |
connect(Object websocket,
URI toUri) |
Future<Session> |
connect(Object websocket,
URI toUri,
ClientUpgradeRequest request)
Connect to remote websocket endpoint
|
Future<Session> |
connect(Object websocket,
URI toUri,
ClientUpgradeRequest request,
UpgradeListener upgradeListener)
Connect to remote websocket endpoint
|
boolean |
equals(Object o) |
long |
getAsyncWriteTimeout()
Deprecated.
|
SocketAddress |
getBindAddress() |
ByteBufferPool |
getBufferPool()
The configured Container Buffer Pool.
|
ConnectionManager |
getConnectionManager()
Deprecated.
|
long |
getConnectTimeout() |
CookieStore |
getCookieStore() |
EventDriverFactory |
getEventDriverFactory() |
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.
|
Set<WebSocketSession> |
getOpenSessions() |
WebSocketPolicy |
getPolicy()
The policy the container is running on.
|
Scheduler |
getScheduler() |
SessionFactory |
getSessionFactory() |
Collection<WebSocketSessionListener> |
getSessionListeners() |
SslContextFactory |
getSslContextFactory()
Get the in use
SslContextFactory |
int |
hashCode() |
boolean |
isDispatchIO()
Deprecated.
|
boolean |
isStopAtShutdown() |
void |
removeSessionListener(WebSocketSessionListener listener) |
void |
setAsyncWriteTimeout(long ms) |
void |
setBindAdddress(SocketAddress bindAddress)
Deprecated.
(this is a bad bad bad typo, it has 3 { @ code " d " } characters in a row) use
HttpClient.setBindAddress(SocketAddress)
to the internal WebSocketClient(HttpClient) |
void |
setBindAddress(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(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 |
setEventDriverFactory(EventDriverFactory eventDriverFactory) |
void |
setExecutor(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 |
setSessionFactory(SessionFactory sessionFactory) |
void |
setStopAtShutdown(boolean stop)
Set JVM shutdown behavior.
|
String |
toString() |
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopisRunningdumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, namedpublic WebSocketClient()
public WebSocketClient(HttpClient httpClient)
httpClient - the HttpClient to use for WebSocketClient.public WebSocketClient(HttpClient httpClient, DecoratedObjectFactory decoratedObjectFactory)
httpClient - the HttpClient that underlying WebSocket client usesdecoratedObjectFactory - the DecoratedObjectFactory for all client instantiated classes@Deprecated public WebSocketClient(SslContextFactory sslContextFactory)
WebSocketClient(HttpClient) insteadsslContextFactory - ssl context factory to use on the internal HttpClient@Deprecated public WebSocketClient(Executor executor)
WebSocketClient(HttpClient) insteadexecutor - the executor to use on the internal HttpClient@Deprecated public WebSocketClient(ByteBufferPool bufferPool)
WebSocketClient(HttpClient) insteadbufferPool - byte buffer pool to use on the internal HttpClient@Deprecated public WebSocketClient(SslContextFactory sslContextFactory, Executor executor)
WebSocketClient(HttpClient) insteadsslContextFactory - ssl context factory to use on the internal HttpClientexecutor - the executor to use on the internal HttpClient@Deprecated public WebSocketClient(WebSocketContainerScope scope)
WebSocketClient(HttpClient) insteadscope - the Container Scope@Deprecated public WebSocketClient(WebSocketContainerScope scope, SslContextFactory sslContextFactory)
WebSocketClient(HttpClient) insteadscope - the Container ScopesslContextFactory - SSL ContextFactory to use in preference to one from
WebSocketContainerScope.getSslContextFactory()@Deprecated public WebSocketClient(SslContextFactory sslContextFactory, Executor executor, ByteBufferPool bufferPool)
WebSocketClient(HttpClient) insteadsslContextFactory - shared SSL ContextFactoryexecutor - shared ExecutorbufferPool - shared ByteBufferPool@Deprecated public WebSocketClient(WebSocketContainerScope scope, EventDriverFactory eventDriverFactory, SessionFactory sessionFactory)
WebSocketClient(WebSocketContainerScope, EventDriverFactory, SessionFactory, HttpClient) insteadscope - 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 Future<Session> connect(Object websocket, URI toUri) throws IOException
IOExceptionpublic Future<Session> connect(Object websocket, URI toUri, ClientUpgradeRequest request) throws IOException
websocket - the websocket objecttoUri - the websocket uri to connect torequest - the upgrade request informationIOException - if unable to connectpublic Future<Session> connect(Object websocket, URI toUri, ClientUpgradeRequest request, UpgradeListener upgradeListener) throws IOException
websocket - the websocket objecttoUri - the websocket uri to connect torequest - the upgrade request informationupgradeListener - the upgrade listenerIOException - if unable to connectpublic void setEventDriverFactory(EventDriverFactory eventDriverFactory)
public void setSessionFactory(SessionFactory sessionFactory)
@Deprecated public boolean isDispatchIO()
@Deprecated public long getAsyncWriteTimeout()
public SocketAddress getBindAddress()
public ByteBufferPool getBufferPool()
WebSocketContainerScopegetBufferPool in interface WebSocketContainerScope@Deprecated public ConnectionManager getConnectionManager()
public long getConnectTimeout()
public CookieStore getCookieStore()
public EventDriverFactory getEventDriverFactory()
public 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 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 Collection<WebSocketSessionListener> getSessionListeners()
getSessionListeners in interface WebSocketContainerScopepublic void setAsyncWriteTimeout(long ms)
@Deprecated public void setBindAdddress(SocketAddress bindAddress)
HttpClient.setBindAddress(SocketAddress)
to the internal WebSocketClient(HttpClient)bindAddress - the address to bind to the internal HttpClientpublic void setBindAddress(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(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(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 String toString()
toString in class AbstractLifeCycleCopyright © 2010 - 2020 Adobe. All Rights Reserved