Interface ServerSentEventParser


public interface ServerSentEventParser
Parses server-sent events (SSE) from an InputStream, constructs ServerSentEvent objects, and delivers them to the provided ServerSentEventListener.

This interface is currently experimental and subject to change.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    parse(InputStream httpResponseBody, ServerSentEventListener listener)
    Parses an input stream containing server-sent events and notifies the listener of parsed events.
  • Method Details

    • parse

      void parse(InputStream httpResponseBody, ServerSentEventListener listener)
      Parses an input stream containing server-sent events and notifies the listener of parsed events. This method blocks until the input stream is exhausted or an error occurs.

      For each complete event found in the stream, ServerSentEventListener.onEvent(ServerSentEvent) is called. If any parsing or processing error occurs, ServerSentEventListener.onError(Throwable) is called and parsing may terminate.

      Parameters:
      httpResponseBody - the input stream containing SSE data to parse
      listener - the listener to receive parsed events or error notifications