Package org.springframework.http.codec
Class ServerSentEvent<T>
- java.lang.Object
- org.springframework.http.codec.ServerSentEvent<T>
- Type Parameters:
T- the type of data that this event contains
public final class ServerSentEvent<T> extends Object
Representation for a Server-Sent Event for use with Spring's reactive Web support.Flux<ServerSentEvent>orObservable<ServerSentEvent>is the reactive equivalent to Spring MVC'sSseEmitter.- Since:
- 5.0
- Author:
- Sebastien Deleuze, Arjen Poutsma
- See Also:
ServerSentEventHttpMessageWriter, Server-Sent Events W3C recommendation
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceServerSentEvent.Builder<T>A mutable builder for aSseEvent.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> ServerSentEvent.Builder<T>builder()Return a builder for aSseEvent.static <T> ServerSentEvent.Builder<T>builder(T data)Return a builder for aSseEvent, populated with the give data.Stringcomment()Return the comment of this event, if available.Tdata()Return thedatafield of this event, if available.Stringevent()Return theeventfield of this event, if available.Stringid()Return theidfield of this event, if available.Durationretry()Return theretryfield of this event, if available.StringtoString()
Method Detail
builder
public static <T> ServerSentEvent.Builder<T> builder()
Return a builder for aSseEvent.- Type Parameters:
T- the type of data that this event contains- Returns:
- the builder
builder
public static <T> ServerSentEvent.Builder<T> builder(T data)
Return a builder for aSseEvent, populated with the give data.- Type Parameters:
T- the type of data that this event contains- Returns:
- the builder