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
Representation for a Server-Sent Event for use with Spring's reactive Web support.
Flux<ServerSentEvent>
or Observable<ServerSentEvent>
is the
reactive equivalent to Spring MVC's SseEmitter
.- Since:
- 5.0
- Author:
- Sebastien Deleuze, Arjen Poutsma
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A mutable builder for aServerSentEvent
. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ServerSentEvent.Builder<T>
builder()
Return a builder for aServerSentEvent
.static <T> ServerSentEvent.Builder<T>
builder
(T data) Return a builder for aServerSentEvent
, populated with the given data.comment()
Return the comment of this event, if available.data()
Return thedata
field of this event, if available.boolean
event()
Return theevent
field of this event, if available.format()
Return a StringBuilder with the id, event, retry, and comment fields fully serialized, and also appending "data:" if there is data.int
hashCode()
id()
Return theid
field of this event, if available.retry()
Return theretry
field of this event, if available.toString()
-
Method Details
-
id
Return theid
field of this event, if available. -
event
Return theevent
field of this event, if available. -
retry
Return theretry
field of this event, if available. -
comment
Return the comment of this event, if available. -
data
Return thedata
field of this event, if available. -
format
Return a StringBuilder with the id, event, retry, and comment fields fully serialized, and also appending "data:" if there is data.- Since:
- 6.2.1
-
equals
-
hashCode
public int hashCode() -
toString
-
builder
Return a builder for aServerSentEvent
.- Type Parameters:
T
- the type of data that this event contains- Returns:
- the builder
-
builder
Return a builder for aServerSentEvent
, populated with the given data.- Type Parameters:
T
- the type of data that this event contains- Returns:
- the builder
-