com.caucho.websocket
Class AbstractWebSocketListener

java.lang.Object
  extended by com.caucho.websocket.AbstractWebSocketListener
All Implemented Interfaces:
WebSocketListener
Direct Known Subclasses:
HmtpClientWebSocketListener, HmtpWebSocketListener

public abstract class AbstractWebSocketListener
extends java.lang.Object
implements 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 every written by a thread other than the serviceRead


Constructor Summary
AbstractWebSocketListener()
           
 
Method Summary
 void onClose(WebSocketContext context)
          Called when the peer closes the connection gracefully.
 void onDisconnect(WebSocketContext context)
          Called when the connection terminates.
 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 when the connection is established
 void onTimeout(WebSocketContext context)
          Called when the connection times out
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractWebSocketListener

public AbstractWebSocketListener()
Method Detail

onStart

public void onStart(WebSocketContext context)
             throws java.io.IOException
Called when the connection is established

Specified by:
onStart in interface WebSocketListener
Throws:
java.io.IOException

onReadBinary

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

Specified by:
onReadBinary in interface WebSocketListener
Throws:
java.io.IOException

onReadText

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

Specified by:
onReadText in interface WebSocketListener
Throws:
java.io.IOException

onClose

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

Specified by:
onClose in interface WebSocketListener
Throws:
java.io.IOException

onDisconnect

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

Specified by:
onDisconnect in interface WebSocketListener
Throws:
java.io.IOException

onTimeout

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

Specified by:
onTimeout in interface WebSocketListener
Throws:
java.io.IOException