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 Details

    • 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 event
      event - 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 error
      throwable - Error that occurred
    • onReconnect

      void onReconnect(HttpEventStreamClient client, HttpResponse<Void> response, boolean hasReceivedEvents, long lastEventID)
      Gets called if HttpEventStreamClient lost connection and will reconnect
      Parameters:
      client - Event stream client that reconnects
      response - Last response received from server (may be null)
      hasReceivedEvents - True if at least one event has been received since the last (re-)connect
      lastEventID - 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 closed
      response - Last response received from server (may be null)