Class StatusResultListener
- java.lang.Object
-
- org.simpleframework.http.socket.service.StatusResultListener
-
- All Implemented Interfaces:
FrameListener
class StatusResultListener extends java.lang.Object implements FrameListener
TheStatusResultListener
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 Summary
Fields Modifier and Type Field Description private StatusChecker
checker
This is used to ping sessions to check for health.
-
Constructor Summary
Constructors Constructor Description StatusResultListener(StatusChecker checker)
Constructor for theStatusResultListener
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onClose(Session session, Reason reason)
This is called when the connection is closed from the other side.void
onError(Session session, java.lang.Exception cause)
This is called when there is an error with the connection.void
onFrame(Session session, Frame frame)
This is called when a new frame arrives on the WebSocket.
-
-
-
Field Detail
-
checker
private final StatusChecker checker
This is used to ping sessions to check for health.
-
-
Constructor Detail
-
StatusResultListener
public StatusResultListener(StatusChecker checker)
Constructor for theStatusResultListener
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 Detail
-
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 interfaceFrameListener
- Parameters:
session
- this is the associated sessionframe
- this is the frame that has been received
-
onError
public void onError(Session session, java.lang.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 interfaceFrameListener
- Parameters:
session
- this is the associated sessioncause
- 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 interfaceFrameListener
- Parameters:
session
- this is the associated sessionreason
- this is the reason the connection was closed
-
-