Class StatusResultListener

java.lang.Object
org.simpleframework.http.socket.service.StatusResultListener
All Implemented Interfaces:
FrameListener

class StatusResultListener extends Object implements FrameListener
The StatusResultListener is used to listen for responses to ping frames sent out by the server. A response to the ping frame is a pong frame. When a pong is received it allows the session to be scheduled to receive another ping.
  • Field Details

    • checker

      private final StatusChecker checker
      This is used to ping sessions to check for health.
  • Constructor Details

    • StatusResultListener

      public StatusResultListener(StatusChecker checker)
      Constructor for the StatusResultListener object. This requires the session health checker that performs the pings so that it can reschedule the session for multiple pings if the connection responds with a pong.
      Parameters:
      checker - this is the session health checker
  • Method Details

    • onFrame

      public void onFrame(Session session, Frame frame)
      This is called when a new frame arrives on the WebSocket. If the frame is a pong then this will reschedule the the session to receive another ping frame.
      Specified by:
      onFrame in interface FrameListener
      Parameters:
      session - this is the associated session
      frame - this is the frame that has been received
    • onError

      public void onError(Session session, Exception cause)
      This is called when there is an error with the connection. When called the session is removed from the checker and no more ping frames are sent.
      Specified by:
      onError in interface FrameListener
      Parameters:
      session - this is the associated session
      cause - this is the cause of the error
    • onClose

      public void onClose(Session session, Reason reason)
      This is called when the connection is closed from the other side. When called the session is removed from the checker and no more ping frames are sent.
      Specified by:
      onClose in interface FrameListener
      Parameters:
      session - this is the associated session
      reason - this is the reason the connection was closed