org.atmosphere.wasync.impl
Class DefaultSocket

java.lang.Object
  extended by org.atmosphere.wasync.impl.DefaultSocket
All Implemented Interfaces:
Socket

public class DefaultSocket
extends Object
implements Socket


Nested Class Summary
protected static class DefaultSocket.InternalSocket
           
 
Nested classes/interfaces inherited from interface org.atmosphere.wasync.Socket
Socket.EVENT
 
Constructor Summary
DefaultSocket(com.ning.http.client.AsyncHttpClient asyncHttpClient, Options options)
           
 
Method Summary
 void close()
          Close this Socket
protected  Socket connect(com.ning.http.client.RequestBuilder r, List<Transport> transports)
           
 Future fire(Object data)
          Send data to the remote Server.
protected  List<Transport> getTransport(Request request)
           
protected  DefaultSocket.InternalSocket internalSocket()
           
 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.
protected  Request request()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSocket

public DefaultSocket(com.ning.http.client.AsyncHttpClient asyncHttpClient,
                     Options options)
Method Detail

fire

public Future fire(Object data)
            throws IOException
Description copied from interface: Socket
Send data to the remote Server.

Specified by:
fire in interface Socket
Returns:
a Future
Throws:
IOException

on

public Socket on(Function<? extends Object> function)
Description copied from interface: Socket
Associate a 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

Specified by:
on in interface Socket
Parameters:
function - a Function
Returns:
this

on

public Socket on(String functionName,
                 Function<? extends Object> function)
Description copied from interface: Socket
Associate a 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 Function.MESSAGE but handling of custom message can be done using a FunctionResolver

Specified by:
on in interface Socket
function - a Function
Returns:
this

open

public Socket open(Request request)
            throws IOException
Description copied from interface: Socket
Connect to the remote Server using the Request's information.

Specified by:
open in interface Socket
Parameters:
request - a Request
Returns:
this
Throws:
IOException

connect

protected Socket connect(com.ning.http.client.RequestBuilder r,
                         List<Transport> transports)
                  throws IOException
Throws:
IOException

close

public void close()
Description copied from interface: Socket
Close this Socket

Specified by:
close in interface Socket

internalSocket

protected DefaultSocket.InternalSocket internalSocket()

getTransport

protected List<Transport> getTransport(Request request)
                                throws IOException
Throws:
IOException

request

protected Request request()


Copyright © 2012. All Rights Reserved.