public class WebSocketClient extends ContainerLifeCycle implements WebSocketContainerScope
AbstractLifeCycle.AbstractLifeCycleListener
Container.InheritedListener, Container.Listener
LifeCycle.Listener
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING
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 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,
Executor executor)
Deprecated.
use
WebSocketClient(HttpClient) instead |
WebSocketClient(SslContextFactory sslContextFactory,
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,
SslContextFactory sslContextFactory)
Create WebSocketClient other Container Scope, to allow sharing of
internal features like Executor, ByteBufferPool, SSLContextFactory, etc.
|
Modifier and Type | Method and Description |
---|---|
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
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
void |
dump(Appendable out,
String indent) |
long |
getAsyncWriteTimeout()
Return the number of milliseconds for a timeout of an attempted write operation.
|
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() |
Masker |
getMasker() |
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() |
SslContextFactory |
getSslContextFactory()
The SslContextFactory in use by the container.
|
boolean |
isDispatchIO()
Deprecated.
|
protected ConnectionManager |
newConnectionManager()
Deprecated.
use HttpClient instead
|
void |
onSessionClosed(WebSocketSession session)
A Session has been closed
|
void |
onSessionOpened(WebSocketSession session)
A Session has been opened
|
void |
setAsyncWriteTimeout(long ms) |
void |
setBindAdddress(SocketAddress bindAddress)
Deprecated.
(this is a bad bad bad typo) use
setBindAddress(SocketAddress) instead |
void |
setBindAddress(SocketAddress bindAddress) |
void |
setBufferPool(ByteBufferPool bufferPool) |
void |
setConnectTimeout(long ms)
Set the timeout for connecting to the remote server.
|
void |
setCookieStore(CookieStore cookieStore) |
void |
setDaemon(boolean daemon) |
void |
setDispatchIO(boolean dispatchIO)
Deprecated.
|
void |
setExecutor(Executor executor) |
void |
setMasker(Masker masker) |
void |
setMaxBinaryMessageBufferSize(int max) |
void |
setMaxIdleTimeout(long ms)
Set the max idle timeout for new connections.
|
void |
setMaxTextMessageBufferSize(int max) |
String |
toString() |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isRunning
public 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 classes@Deprecated public WebSocketClient(Executor executor)
WebSocketClient(HttpClient)
insteadexecutor
- the executor to use@Deprecated public WebSocketClient(ByteBufferPool bufferPool)
WebSocketClient(HttpClient)
insteadbufferPool
- byte buffer pool to usepublic WebSocketClient(SslContextFactory sslContextFactory)
sslContextFactory
- ssl context factory to use@Deprecated public WebSocketClient(SslContextFactory sslContextFactory, Executor executor)
WebSocketClient(HttpClient)
insteadsslContextFactory
- ssl context factory to useexecutor
- the executor to usepublic 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, 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 Future<Session> connect(Object websocket, URI toUri) throws IOException
IOException
public 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 connectprotected void doStop() throws Exception
ContainerLifeCycle
doStop
in class ContainerLifeCycle
Exception
@Deprecated public boolean isDispatchIO()
public long getAsyncWriteTimeout()
public SocketAddress getBindAddress()
public ByteBufferPool getBufferPool()
WebSocketContainerScope
getBufferPool
in interface WebSocketContainerScope
@Deprecated public ConnectionManager getConnectionManager()
public long getConnectTimeout()
public CookieStore getCookieStore()
public EventDriverFactory getEventDriverFactory()
public Executor getExecutor()
WebSocketContainerScope
getExecutor
in interface WebSocketContainerScope
public ExtensionFactory getExtensionFactory()
public Masker getMasker()
public int getMaxBinaryMessageBufferSize()
public long getMaxBinaryMessageSize()
public long getMaxIdleTimeout()
public int getMaxTextMessageBufferSize()
public long getMaxTextMessageSize()
public DecoratedObjectFactory getObjectFactory()
WebSocketContainerScope
getObjectFactory
in interface WebSocketContainerScope
public Set<WebSocketSession> getOpenSessions()
public WebSocketPolicy getPolicy()
WebSocketContainerScope
getPolicy
in interface WebSocketContainerScope
public Scheduler getScheduler()
public SessionFactory getSessionFactory()
public SslContextFactory getSslContextFactory()
WebSocketContainerScope
getSslContextFactory
in interface WebSocketContainerScope
SslContextFactory
that manages TLS encryptionWebSocketClient(SslContextFactory)
@Deprecated protected ConnectionManager newConnectionManager()
public void onSessionClosed(WebSocketSession session)
WebSocketContainerScope
onSessionClosed
in interface WebSocketContainerScope
session
- the session that was closedpublic void onSessionOpened(WebSocketSession session)
WebSocketContainerScope
onSessionOpened
in interface WebSocketContainerScope
session
- the session that was openedpublic void setAsyncWriteTimeout(long ms)
@Deprecated public void setBindAdddress(SocketAddress bindAddress)
setBindAddress(SocketAddress)
insteadbindAddress
- the address to bind topublic void setBindAddress(SocketAddress bindAddress)
public void setBufferPool(ByteBufferPool bufferPool)
public void setConnectTimeout(long ms)
ms
- the timeout in millisecondspublic void setCookieStore(CookieStore cookieStore)
public void setDaemon(boolean daemon)
@Deprecated public void setDispatchIO(boolean dispatchIO)
public void setExecutor(Executor executor)
public void setMasker(Masker masker)
public 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 void dump(Appendable out, String indent) throws IOException
dump
in interface Dumpable
dump
in class ContainerLifeCycle
IOException
public HttpClient getHttpClient()
Copyright © 1995–2017 Webtide. All rights reserved.