|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.wasync.impl.DefaultSocket
public class DefaultSocket
Default implementation of the Socket
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.atmosphere.wasync.Socket |
|---|
Socket.STATUS |
| Field Summary | |
|---|---|
protected List<FunctionWrapper> |
functions
|
protected Options |
options
|
protected Request |
request
|
protected SocketRuntime |
socketRuntime
|
protected Transport |
transportInUse
|
| Constructor Summary | |
|---|---|
DefaultSocket(Options options)
|
|
| Method Summary | |
|---|---|
protected void |
addFunction(long timeout,
TimeUnit tu)
|
void |
close()
Close this Socket, asynchronously. |
protected void |
closeRuntime(boolean async)
|
protected Socket |
connect(com.ning.http.client.RequestBuilder r,
List<Transport> transports)
|
protected Socket |
connect(com.ning.http.client.RequestBuilder r,
List<Transport> transports,
long timeout,
TimeUnit tu)
|
SocketRuntime |
createRuntime(DefaultFuture future,
Options options,
List<FunctionWrapper> functions)
|
Future |
fire(Object data)
Send data to the remote Server. |
protected List<Transport> |
getTransport(com.ning.http.client.RequestBuilder r,
Request request)
|
protected SocketRuntime |
internalSocket()
|
Socket |
on(Event event,
Function<?> function)
Associate a Function with an Event. |
Socket |
on(Function<? extends Object> function)
Associate a Function with the Socket. |
Socket |
on(String functionName,
Function<? extends Object> function)
Associate a Function with the Socket. |
Socket |
open(Request request)
Connect to the remote Server using the Request's information. |
Socket |
open(Request request,
long timeout,
TimeUnit tu)
Connect to the remote Server using the Request's information, will timeout if the connection failed to open
within a certain time |
protected Request |
request()
|
Socket.STATUS |
status()
Return the Socket.STATUS of this Socket. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Request request
protected SocketRuntime socketRuntime
protected final List<FunctionWrapper> functions
protected Transport transportInUse
protected final Options options
| Constructor Detail |
|---|
public DefaultSocket(Options options)
| Method Detail |
|---|
public Future fire(Object data)
throws IOException
Encoder, and then send to the server.
The server's response will be delivered to the set of defined Function using the opened Transport, e.g for
Request.TRANSPORT.WEBSOCKET, the same connection will be re-used and, for others transports, the suspended connection.
fire in interface Socketdata - object to send
Future
IOExceptionpublic Socket on(Function<? extends Object> function)
Function with the Socket. When a response is received, the library will try to associated
the decoded message (decoded by Decoder) to the defined type of the Function
on in interface Socketfunction - a Function
public Socket on(String functionName,
Function<? extends Object> function)
Function with the Socket. When a response is received, the library will try to associated
the decoded message (decoded by Decoder) to the defined type of the Function. The default messages
are defined by Event but handling of custom message can be done using a FunctionResolver
on in interface Socketfunction - a Function
public Socket on(Event event,
Function<?> function)
SocketFunction with an Event. When the event happen the library will try to associated
the decoded event (decoded by Decoder) to the defined type of the Function. The default event
are defined by Event but handling of custom event can be done using a FunctionResolver
on in interface Socketfunction - a Function
public Socket open(Request request)
throws IOException
SocketRequest's information.
open in interface Socketrequest - a Request
IOException
public Socket open(Request request,
long timeout,
TimeUnit tu)
throws IOException
Request's information, will timeout if the connection failed to open
within a certain time
open in interface Socketrequest - a Requesttimeout - the maximum time to waittu - the time unit of the timeout argument
IOException
protected Socket connect(com.ning.http.client.RequestBuilder r,
List<Transport> transports)
throws IOException
IOException
protected Socket connect(com.ning.http.client.RequestBuilder r,
List<Transport> transports,
long timeout,
TimeUnit tu)
throws IOException
IOException
protected void addFunction(long timeout,
TimeUnit tu)
public void close()
close in interface Socketprotected void closeRuntime(boolean async)
public Socket.STATUS status()
SocketSocket.STATUS of this Socket.
status in interface Socketprotected SocketRuntime internalSocket()
protected List<Transport> getTransport(com.ning.http.client.RequestBuilder r,
Request request)
throws IOException
IOExceptionprotected Request request()
public SocketRuntime createRuntime(DefaultFuture future,
Options options,
List<FunctionWrapper> functions)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||