A convenience for wrapping onResponse handlers where the event stream HTTP response is successful.
A convenience for wrapping onResponse handlers where the event stream HTTP response is successful.
the handler of the successful HTTP response
the response passed in by the sseFlow, which can have failed
Provides a flow representing a common pipeline for handling the establishment of an SSE event stream and its termination.
Provides a flow representing a common pipeline for handling the establishment of an SSE event stream and its termination. The flow produces SSE elements. This flow is intended to be used in conjunction with having established a connection and made a request. For example:
Source .single(myRequest) .via(myConnection) .via( sseFlow( onSuccess { httpResponse => // Do something given a successful establishment of an event stream }, { outcome => // Do something given that the event stream has terminated } ) ) .runForeach { sseEvent => // Do something for each event }
the initial response handler
the handler to call when the connection has been terminated
an execution context for certain parts of the flow mappings
a materializer for certain parts of the flow
a flow that emits ServerSentEvent elements
Common streaming patterns for SSE