com.github.nkzawa.socketio.client
Class Socket

java.lang.Object
  extended by com.github.nkzawa.emitter.Emitter
      extended by com.github.nkzawa.socketio.client.Socket

public class Socket
extends com.github.nkzawa.emitter.Emitter

The socket class for Socket.IO Client.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.github.nkzawa.emitter.Emitter
com.github.nkzawa.emitter.Emitter.Listener
 
Field Summary
static String EVENT_CONNECT
          Called on a connection.
static String EVENT_CONNECT_ERROR
           
static String EVENT_CONNECT_TIMEOUT
           
static String EVENT_DISCONNECT
          Called on a disconnection.
static String EVENT_ERROR
          Called on a connection error.
static String EVENT_MESSAGE
           
static String EVENT_RECONNECT
           
static String EVENT_RECONNECT_ATTEMPT
           
static String EVENT_RECONNECT_ERROR
           
static String EVENT_RECONNECT_FAILED
           
static String EVENT_RECONNECTING
           
 
Constructor Summary
Socket(Manager io, String nsp)
           
 
Method Summary
 Socket close()
          Disconnects the socket.
 Socket connect()
          Connects the socket.
 boolean connected()
           
 Socket disconnect()
          Disconnects the socket.
 com.github.nkzawa.emitter.Emitter emit(String event, Object... args)
          Emits an event.
 com.github.nkzawa.emitter.Emitter emit(String event, Object[] args, Ack ack)
          Emits an event with an acknowledge.
 Manager io()
           
 Socket open()
          Connects the socket.
 Socket send(Object... args)
          Send messages.
 
Methods inherited from class com.github.nkzawa.emitter.Emitter
hasListeners, listeners, off, off, off, on, once
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_CONNECT

public static final String EVENT_CONNECT
Called on a connection.

See Also:
Constant Field Values

EVENT_DISCONNECT

public static final String EVENT_DISCONNECT
Called on a disconnection.

See Also:
Constant Field Values

EVENT_ERROR

public static final String EVENT_ERROR
Called on a connection error.

Parameters:

See Also:
Constant Field Values

EVENT_MESSAGE

public static final String EVENT_MESSAGE
See Also:
Constant Field Values

EVENT_CONNECT_ERROR

public static final String EVENT_CONNECT_ERROR
See Also:
Constant Field Values

EVENT_CONNECT_TIMEOUT

public static final String EVENT_CONNECT_TIMEOUT
See Also:
Constant Field Values

EVENT_RECONNECT

public static final String EVENT_RECONNECT
See Also:
Constant Field Values

EVENT_RECONNECT_ERROR

public static final String EVENT_RECONNECT_ERROR
See Also:
Constant Field Values

EVENT_RECONNECT_FAILED

public static final String EVENT_RECONNECT_FAILED
See Also:
Constant Field Values

EVENT_RECONNECT_ATTEMPT

public static final String EVENT_RECONNECT_ATTEMPT
See Also:
Constant Field Values

EVENT_RECONNECTING

public static final String EVENT_RECONNECTING
See Also:
Constant Field Values
Constructor Detail

Socket

public Socket(Manager io,
              String nsp)
Method Detail

open

public Socket open()
Connects the socket.


connect

public Socket connect()
Connects the socket.


send

public Socket send(Object... args)
Send messages.

Parameters:
args - data to send.
Returns:
a reference to this object.

emit

public com.github.nkzawa.emitter.Emitter emit(String event,
                                              Object... args)
Emits an event. When you pass Ack at the last argument, then the acknowledge is done.

Overrides:
emit in class com.github.nkzawa.emitter.Emitter
Parameters:
event - an event name.
args - data to send.
Returns:
a reference to this object.

emit

public com.github.nkzawa.emitter.Emitter emit(String event,
                                              Object[] args,
                                              Ack ack)
Emits an event with an acknowledge.

Parameters:
event - an event name
args - data to send.
ack - the acknowledgement to be called
Returns:
a reference to this object.

close

public Socket close()
Disconnects the socket.

Returns:
a reference to this object.

disconnect

public Socket disconnect()
Disconnects the socket.

Returns:
a reference to this object.

io

public Manager io()

connected

public boolean connected()


Copyright © 2014. All rights reserved.