io.socket.transports
Class WebsocketTransport

java.lang.Object
  extended by net.tootallnate.websocket.WebSocketAdapter
      extended by net.tootallnate.websocket.WebSocketClient
          extended by io.socket.transports.WebsocketTransport
All Implemented Interfaces:
IOTransport, java.lang.Runnable

public class WebsocketTransport
extends net.tootallnate.websocket.WebSocketClient
implements IOTransport

The Class WebsocketTransport.


Field Summary
static java.lang.String TRANSPORT_NAME
          The String to identify this Transport
 
Constructor Summary
WebsocketTransport(java.net.URI uri, IOConnection connection)
          Instantiates a new websocket transport.
 
Method Summary
 boolean canSendBulk()
          return true if the IOTransport prefers to send multiple messages at a time.
static IOTransport create(java.net.URL url, IOConnection connection)
          Creates a new Transport for the given url an IOConnection.
 void disconnect()
          Instructs the IOTransport to disconnect.
 void invalidate()
          Instructs the IOTransport to invalidate.
 void onClose()
           
 void onIOError(java.io.IOException error)
           
 void onMessage(java.lang.String message)
           
 void onOpen()
           
 void sendBulk(java.lang.String[] texts)
          Instructs the IOTransport to send multiple messages.
 
Methods inherited from class net.tootallnate.websocket.WebSocketClient
close, connect, getDraft, getURI, onClose, onIOError, onMessage, onOpen, releaseAndInitialize, run, send
 
Methods inherited from class net.tootallnate.websocket.WebSocketAdapter
getFlashPolicy, onError, onHandshakeRecievedAsClient, onHandshakeRecievedAsServer, onMessage, onPong
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface io.socket.IOTransport
connect, send
 

Field Detail

TRANSPORT_NAME

public static final java.lang.String TRANSPORT_NAME
The String to identify this Transport

See Also:
Constant Field Values
Constructor Detail

WebsocketTransport

public WebsocketTransport(java.net.URI uri,
                          IOConnection connection)
Instantiates a new websocket transport.

Parameters:
uri - the uri
connection - the connection
Method Detail

create

public static IOTransport create(java.net.URL url,
                                 IOConnection connection)
Creates a new Transport for the given url an IOConnection.

Parameters:
url - the url
connection - the connection
Returns:
the iO transport

onClose

public void onClose()
Specified by:
onClose in class net.tootallnate.websocket.WebSocketClient

onIOError

public void onIOError(java.io.IOException error)
Specified by:
onIOError in class net.tootallnate.websocket.WebSocketClient

onMessage

public void onMessage(java.lang.String message)
Specified by:
onMessage in class net.tootallnate.websocket.WebSocketClient

onOpen

public void onOpen()
Specified by:
onOpen in class net.tootallnate.websocket.WebSocketClient

disconnect

public void disconnect()
Description copied from interface: IOTransport
Instructs the IOTransport to disconnect.

Specified by:
disconnect in interface IOTransport

canSendBulk

public boolean canSendBulk()
Description copied from interface: IOTransport
return true if the IOTransport prefers to send multiple messages at a time.

Specified by:
canSendBulk in interface IOTransport
Returns:
true, if successful

sendBulk

public void sendBulk(java.lang.String[] texts)
              throws java.io.IOException
Description copied from interface: IOTransport
Instructs the IOTransport to send multiple messages. This is only called when canSendBulk returns true.

Specified by:
sendBulk in interface IOTransport
Parameters:
texts - the texts
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

invalidate

public void invalidate()
Description copied from interface: IOTransport
Instructs the IOTransport to invalidate. DO NOT DISCONNECT from the server. just make sure, that events are not populated to the IOConnection

Specified by:
invalidate in interface IOTransport