org.webbitserver
Class BaseWebSocketHandler

java.lang.Object
  extended by org.webbitserver.BaseWebSocketHandler
All Implemented Interfaces:
WebSocketHandler

public class BaseWebSocketHandler
extends Object
implements WebSocketHandler

Base implementation that does nothing, except for automatically calling WebSocketConnection.pong(byte[]) when onPing(WebSocketConnection, byte[]) receives a ping.


Constructor Summary
BaseWebSocketHandler()
           
 
Method Summary
 void onClose(WebSocketConnection connection)
          Called when a connection is closed.
 void onMessage(WebSocketConnection connection, byte[] msg)
           
 void onMessage(WebSocketConnection connection, String msg)
           
 void onOpen(WebSocketConnection connection)
           
 void onPing(WebSocketConnection connection, byte[] msg)
           
 void onPong(WebSocketConnection connection, byte[] msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseWebSocketHandler

public BaseWebSocketHandler()
Method Detail

onOpen

public void onOpen(WebSocketConnection connection)
            throws Exception
Specified by:
onOpen in interface WebSocketHandler
Throws:
Exception

onClose

public void onClose(WebSocketConnection connection)
             throws Exception
Description copied from interface: WebSocketHandler
Called when a connection is closed.

Specified by:
onClose in interface WebSocketHandler
Parameters:
connection - the connection that was closed. Beware that the connection will be null if this handler is used in a WebSocket that fails to connect.
Throws:
Exception

onMessage

public void onMessage(WebSocketConnection connection,
                      String msg)
               throws Throwable
Specified by:
onMessage in interface WebSocketHandler
Throws:
Throwable

onMessage

public void onMessage(WebSocketConnection connection,
                      byte[] msg)
               throws Throwable
Specified by:
onMessage in interface WebSocketHandler
Throws:
Throwable

onPing

public void onPing(WebSocketConnection connection,
                   byte[] msg)
            throws Throwable
Specified by:
onPing in interface WebSocketHandler
Throws:
Throwable

onPong

public void onPong(WebSocketConnection connection,
                   byte[] msg)
            throws Throwable
Specified by:
onPong in interface WebSocketHandler
Throws:
Throwable


Copyright © 2013. All Rights Reserved.