Package ratpack.core.sse.client
Interface ServerSentEventResponse
-
- All Superinterfaces:
HttpResponse
,StreamedResponse
public interface ServerSentEventResponse extends StreamedResponse
A response for a server sent event stream.- Since:
- 1.10
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TransformablePublisher<ServerSentEvent>
getEvents()
The response body parsed as events.boolean
isEventStream()
Whether the response is actually an event stream.-
Methods inherited from interface ratpack.core.http.client.HttpResponse
getHeaders, getStatus, getStatusCode
-
Methods inherited from interface ratpack.core.http.client.StreamedResponse
forwardTo, forwardTo, getBody
-
-
-
-
Method Detail
-
isEventStream
boolean isEventStream()
Whether the response is actually an event stream.The server may have responded with some other type of content, or an error status code.
If this method returns false,
getEvents()
will throw an exception when called. The non event-stream response body can be read viaStreamedResponse.getBody()
.- Returns:
- whether the response is actually an event stream
-
getEvents
TransformablePublisher<ServerSentEvent> getEvents()
The response body parsed as events. IfisEventStream()
returns false, this method will throw an exception when called. The non event-stream response body can be read viaStreamedResponse.getBody()
.- Returns:
- the event stream
-
-