T
- the type of data that this event containspublic class ServerSentEvent<T>
extends java.lang.Object
Flux<ServerSentEvent>
or Observable<ServerSentEvent>
is the
reactive equivalent to Spring MVC's SseEmitter
.ServerSentEventHttpMessageWriter
,
Server-Sent Events W3C recommendationModifier and Type | Class and Description |
---|---|
static interface |
ServerSentEvent.Builder<T>
A mutable builder for a
SseEvent . |
private static class |
ServerSentEvent.BuilderImpl<T> |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
comment |
private T |
data |
private java.lang.String |
event |
private java.lang.String |
id |
private java.time.Duration |
retry |
Modifier | Constructor and Description |
---|---|
private |
ServerSentEvent(java.lang.String id,
java.lang.String event,
java.time.Duration retry,
java.lang.String comment,
T data) |
Modifier and Type | Method and Description |
---|---|
static <T> ServerSentEvent.Builder<T> |
builder()
Return a builder for a
SseEvent . |
static <T> ServerSentEvent.Builder<T> |
builder(T data)
Return a builder for a
SseEvent , populated with the give data. |
java.lang.String |
comment()
Return the comment of this event, if available.
|
T |
data()
Return the
data field of this event, if available. |
java.lang.String |
event()
Return the
event field of this event, if available. |
java.lang.String |
id()
Return the
id field of this event, if available. |
java.time.Duration |
retry()
Return the
retry field of this event, if available. |
java.lang.String |
toString() |
@Nullable private final java.lang.String id
@Nullable private final java.lang.String event
@Nullable private final java.time.Duration retry
@Nullable private final java.lang.String comment
@Nullable public java.lang.String id()
id
field of this event, if available.@Nullable public java.lang.String event()
event
field of this event, if available.@Nullable public java.time.Duration retry()
retry
field of this event, if available.@Nullable public java.lang.String comment()
public java.lang.String toString()
toString
in class java.lang.Object
public static <T> ServerSentEvent.Builder<T> builder()
SseEvent
.T
- the type of data that this event containspublic static <T> ServerSentEvent.Builder<T> builder(T data)
SseEvent
, populated with the give data.T
- the type of data that this event contains