org.simpleframework.http.socket
Interface FrameListener


public interface FrameListener

The FrameListener is used to listen for incoming frames on a WebSocket. Any number of listeners can listen on a single web socket and it will receive all incoming events. For consistency this interface is modelled on the WebSocket API as defined by W3C Candidate Recommendation as of 20 September 2012.

Author:
Niall Gallagher
See Also:
FrameChannel

Method Summary
 void onClose(Session session, Reason reason)
          This is called when the connection is closed from the other side.
 void onError(Session session, Exception cause)
          This is called when an error occurs on the WebSocket.
 void onFrame(Session session, Frame frame)
          This is called when a new frame arrives on the WebSocket.
 

Method Detail

onFrame

void onFrame(Session session,
             Frame frame)
This is called when a new frame arrives on the WebSocket. It will receive control frames as well as binary and text user frames. Control frames should not be acted on or responded to as they are provided for informational purposes only.

Parameters:
session - this is the associated session
frame - this is the frame that has been received

onError

void onError(Session session,
             Exception cause)
This is called when an error occurs on the WebSocket. After an error the connection it is closed with an opcode indicating an internal server error.

Parameters:
session - this is the associated session
frame - this is the exception that has been thrown

onClose

void onClose(Session session,
             Reason reason)
This is called when the connection is closed from the other side. Typically a frame with an opcode of close is sent before the close callback is issued.

Parameters:
session - this is the associated session
reason - this is the reason the connection was closed


Copyright © 2014. All Rights Reserved.