Interface EventStreamListener
-
- All Known Implementing Classes:
EventStreamAdapter,HttpEventStreamClient.InternalEventStreamAdapter
public interface EventStreamListenerInterface to implement event stream listeners for theHttpEventStreamClient- Since:
- 2020-12-22
- Author:
- LupCode.com (Luca Vogels)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonClose(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 Detail
-
onEvent
void onEvent(HttpEventStreamClient client, HttpEventStreamClient.Event event)
Gets called if a new event has been received- Parameters:
client- Event stream client that received the eventevent- Event that has been received
-
onError
void onError(HttpEventStreamClient client, Throwable throwable)
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
void onClose(HttpEventStreamClient client, HttpResponse<Void> response)
Gets called if client has been closed- Parameters:
client- Event stream client that has closedresponse- Last response received from server (may be null)
-
-