Class StatusResultListener
java.lang.Object
org.simpleframework.http.socket.service.StatusResultListener
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final StatusCheckerThis is used to ping sessions to check for health. -
Constructor Summary
ConstructorsConstructorDescriptionStatusResultListener(StatusChecker checker) Constructor for theStatusResultListenerobject. -
Method Summary
Modifier and TypeMethodDescriptionvoidThis is called when the connection is closed from the other side.voidThis is called when there is an error with the connection.voidThis is called when a new frame arrives on the WebSocket.
-
Field Details
-
checker
This is used to ping sessions to check for health.
-
-
Constructor Details
-
StatusResultListener
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 Details
-
onFrame
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
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
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
-