com.glines.socketio.client.common
Interface SocketIOConnection

All Known Implementing Classes:
SocketIOConnectionImpl, SocketIOConnectionXHRBase

public interface SocketIOConnection


Nested Class Summary
static interface SocketIOConnection.Factory
           
static interface SocketIOConnection.SocketIOConnectionListener
           
 
Method Summary
 void close()
          Initiate an orderly close of the connection.
 void connect()
          Initiate a connection attempt.
 void disconnect()
          Forcefully disconnect the connection, discarding any unsent messages.
 ConnectionState getConnectionState()
          Return the current socket connection state.
 void sendMessage(int messageType, String message)
          Send a message.
 void sendMessage(String message)
          Send a message.
 

Method Detail

connect

void connect()
Initiate a connection attempt. If the connection succeeds, then the onConnect will be called. If the connection attempt fails, then onDisonnect will be called.

Throws:
IllegalStateException - if the socket is not CLOSED.

disconnect

void disconnect()
Forcefully disconnect the connection, discarding any unsent messages. This does nothing if the connection is already CLOSED. This will abort an orderly close if one was initiated.


close

void close()
Initiate an orderly close of the connection.

Throws:
IllegalStateException - if the socket is not CONNECTED.

getConnectionState

ConnectionState getConnectionState()
Return the current socket connection state.

Returns:

sendMessage

void sendMessage(String message)
                 throws SocketIOException
Send a message.

Parameters:
message -
Throws:
IllegalStateException - if the socket is not CONNECTED.
SocketIOException

sendMessage

void sendMessage(int messageType,
                 String message)
                 throws SocketIOException
Send a message. With a default priority of 0.

Parameters:
message -
Throws:
IllegalStateException - if the socket is not CONNECTED.
SocketIOMessageParserException - if the message type parser encode() failed.
SocketIOException


Copyright © 2010-2011. All Rights Reserved.