com.caucho.websocket
Interface WebSocketListener

All Known Implementing Classes:
AbstractWebSocketListener, HmtpClientWebSocketListener, HmtpWebSocketListener

public interface WebSocketListener

Application handler for a WebSocket tcp stream The read stream should only be read by the onRead thread. The write stream must be synchronized if it's ever written by a thread other than the serviceRead


Method Summary
 void onClose(WebSocketContext context)
          Called when the peer closes the connection gracefully.
 void onDisconnect(WebSocketContext context)
          Called when the connection disconnects.
 void onReadBinary(WebSocketContext context, java.io.InputStream is)
          Called when a binary message is available
 void onReadText(WebSocketContext context, java.io.Reader is)
          Called when a text message is available
 void onStart(WebSocketContext context)
          Called after the server sends its handshake response.
 void onTimeout(WebSocketContext context)
          Called when the connection times out
 

Method Detail

onStart

void onStart(WebSocketContext context)
             throws java.io.IOException
Called after the server sends its handshake response. After receiving the onStart, the application can send binary and text messages.

Throws:
java.io.IOException

onReadBinary

void onReadBinary(WebSocketContext context,
                  java.io.InputStream is)
                  throws java.io.IOException
Called when a binary message is available

Throws:
java.io.IOException

onReadText

void onReadText(WebSocketContext context,
                java.io.Reader is)
                throws java.io.IOException
Called when a text message is available

Throws:
java.io.IOException

onClose

void onClose(WebSocketContext context)
             throws java.io.IOException
Called when the peer closes the connection gracefully.

Throws:
java.io.IOException

onDisconnect

void onDisconnect(WebSocketContext context)
                  throws java.io.IOException
Called when the connection disconnects.

Throws:
java.io.IOException

onTimeout

void onTimeout(WebSocketContext context)
               throws java.io.IOException
Called when the connection times out

Throws:
java.io.IOException