T
- public abstract class OptionsBuilder<U extends Options,T extends OptionsBuilder<U,T>> extends Object
Options
Modifier | Constructor and Description |
---|---|
protected |
OptionsBuilder(Class<T> derived) |
Modifier and Type | Method and Description |
---|---|
boolean |
binary()
Return true is server's response binary is supported.
|
T |
binary(boolean binary)
Set to true in order to received byte data from the server.
|
abstract U |
build()
Build an
Options |
T |
pauseBeforeReconnectInMilliseconds(int reconnectTimeoutInMilliseconds)
The time in milliseconds, before the reconnection occurs.
|
T |
pauseBeforeReconnectInSeconds(int reconnectInSecond)
The time in seconds, before the reconnection occurs.
|
boolean |
reconnect()
Reconnect after a network failure or when the server close the connection.
|
T |
reconnect(boolean reconnect)
Automatically reconnect in case the connection get closed.
|
int |
reconnectAttempts()
Maximum reconnection attempts that will be executed if the connection is lost.
|
T |
reconnectAttempts(int reconnectAttempts)
Maximum reconnection attempts that will be executed if the connection is lost.
|
int |
reconnectTimeoutInMilliseconds()
The delay, in milliseconds, before reconnecting.
|
T |
registerTransport(Transport transport)
Register a new
Transport implementation. |
int |
requestTimeoutInSeconds()
The time, in seconds to wait before closing the connection.
|
T |
requestTimeoutInSeconds(int requestTimeout)
The time, in seconds, the connection will stay open when waiting for new messages.
|
com.ning.http.client.AsyncHttpClient |
runtime()
The
AsyncHttpClient used to communicate with server. |
T |
runtime(com.ning.http.client.AsyncHttpClient client)
Allow an application that want to share
AsyncHttpClient or configure it before it gets used
by the library. |
T |
runtime(com.ning.http.client.AsyncHttpClient client,
boolean runtimeShared)
Allow an application that want to share
AsyncHttpClient or configure it before it gets used
by the library. |
boolean |
runtimeShared()
Return true is the
AsyncHttpClient is shared between Socket . |
T |
runtimeShared(boolean runtimeShared)
Set to true if your AsyncHttpClient is shared between clients.
|
Transport |
transport()
The used
Transport |
long |
waitBeforeUnlocking()
The delay before considering the http connection has been fully processed by the server.
|
T |
waitBeforeUnlocking(long waitBeforeUnlocking)
For streaming and long-polling, the server may not send the headers so the client never knows
if the connection succeeded or not.
|
protected final Class<T extends OptionsBuilder<U,T>> derived
public T requestTimeoutInSeconds(int requestTimeout)
public T registerTransport(Transport transport)
Transport
implementation. Register a transport only if you are planning to use
a different transport than the supported one.transport
- Transport
public T reconnect(boolean reconnect)
reconnect
- reconnect in case the connection get closed. Default is truepublic T pauseBeforeReconnectInSeconds(int reconnectInSecond)
reconnectInSecond
- time in seconds, before the reconnection occurs. Default is instant.public T pauseBeforeReconnectInMilliseconds(int reconnectTimeoutInMilliseconds)
reconnectTimeoutInMilliseconds
- time in milliseconds, before the reconnection occurs. Default is instant.public T reconnectAttempts(int reconnectAttempts)
#reconnectInSeconds
public T waitBeforeUnlocking(long waitBeforeUnlocking)
waitBeforeUnlocking
- the time in millisecondpublic T runtimeShared(boolean runtimeShared)
runtimeShared
- true if your AsyncHttpClient is shared between clients.public T runtime(com.ning.http.client.AsyncHttpClient client)
AsyncHttpClient
or configure it before it gets used
by the library. Application must call AsyncHttpClient.close()
at the end of their
execution as the library won't close it since shared.client
- public T runtime(com.ning.http.client.AsyncHttpClient client, boolean runtimeShared)
AsyncHttpClient
or configure it before it gets used
by the library.client
- runtimeShared
- to true if the runtime is shared between clients. If shared, the asyncHttpClient.close()
must be invoked by the application itself.public boolean reconnect()
public int reconnectTimeoutInMilliseconds()
public int reconnectAttempts()
#reconnectInSeconds
public long waitBeforeUnlocking()
Socket.fire(Object)
to send message. Server side framework that aren't sending any data when suspending a connection may not be ready to fullfil request, hence some data may be lost.
Framework like Atmosphere, Socket.io, Cometd do send some "handshake data" allow the fire operation to be available fast without loosing ant data.public com.ning.http.client.AsyncHttpClient runtime()
AsyncHttpClient
used to communicate with server.AsyncHttpClient
used to communicate with server.public boolean runtimeShared()
AsyncHttpClient
is shared between Socket
. Default is false. You need to invoke runtime(com.ning.http.client.AsyncHttpClient)
to make
it shared.AsyncHttpClient
public int requestTimeoutInSeconds()
public T binary(boolean binary)
binary
- true to enabledpublic boolean binary()
Copyright © 2015. All Rights Reserved.