Interface EventStreamListener
- All Known Implementing Classes:
EventStreamAdapter,HttpEventStreamClient.InternalEventStreamAdapter
public interface EventStreamListener
Interface to implement event stream listeners for the
HttpEventStreamClient- Since:
- 2020-12-22
- Author:
- LupCode.com (Luca Vogels)
-
Method Summary
Modifier and TypeMethodDescriptionvoidonClose(HttpEventStreamClient client, HttpResponse<Void> response) Gets called if client has been closedvoidonError(HttpEventStreamClient client, Throwable throwable) Gets called if an error has occurredvoidonEvent(HttpEventStreamClient client, HttpEventStreamClient.Event event) Gets called if a new event has been receivedvoidonReconnect(HttpEventStreamClient client, HttpResponse<Void> response, boolean hasReceivedEvents, long lastEventID) Gets called ifHttpEventStreamClientlost connection and will reconnect
-
Method Details
-
onEvent
Gets called if a new event has been received- Parameters:
client- Event stream client that received the eventevent- Event that has been received
-
onError
Gets called if an error has occurred- Parameters:
client- Event stream client that caused the errorthrowable- Error that occurred
-
onReconnect
void onReconnect(HttpEventStreamClient client, HttpResponse<Void> response, boolean hasReceivedEvents, long lastEventID) Gets called ifHttpEventStreamClientlost connection and will reconnect- Parameters:
client- Event stream client that reconnectsresponse- Last response received from server (may be null)hasReceivedEvents- True if at least one event has been received since the last (re-)connectlastEventID- ID of last event that was received
-
onClose
Gets called if client has been closed- Parameters:
client- Event stream client that has closedresponse- Last response received from server (may be null)
-