Class StatusResultListener
- java.lang.Object
-
- org.simpleframework.http.socket.service.StatusResultListener
-
- All Implemented Interfaces:
FrameListener
class StatusResultListener extends java.lang.Object implements FrameListener
TheStatusResultListeneris 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 StatusCheckercheckerThis is used to ping sessions to check for health.
-
Constructor Summary
Constructors Constructor Description StatusResultListener(StatusChecker checker)Constructor for theStatusResultListenerobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonClose(Session session, Reason reason)This is called when the connection is closed from the other side.voidonError(Session session, java.lang.Exception cause)This is called when there is an error with the connection.voidonFrame(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 theStatusResultListenerobject. 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:
onFramein 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:
onErrorin 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:
onClosein interfaceFrameListener- Parameters:
session- this is the associated sessionreason- this is the reason the connection was closed
-
-