类 ServerSentEvent<T>
- java.lang.Object
- org.springframework.http.codec.ServerSentEvent<T>
- 类型参数:
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
.- 从以下版本开始:
- 5.0
- 作者:
- Sebastien Deleuze, Arjen Poutsma
- 另请参阅:
ServerSentEventHttpMessageWriter
, Server-Sent Events W3C recommendation
嵌套类概要
嵌套类 修饰符和类型 类 说明 static interface
ServerSentEvent.Builder<T>
A mutable builder for aSseEvent
.
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 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.String
comment()
Return the comment of this event, if available.T
data()
Return thedata
field of this event, if available.String
event()
Return theevent
field of this event, if available.String
id()
Return theid
field of this event, if available.Duration
retry()
Return theretry
field of this event, if available.String
toString()
方法详细资料
builder
public static <T> ServerSentEvent.Builder<T> builder()
Return a builder for aSseEvent
.- 类型参数:
T
- the type of data that this event contains- 返回:
- the builder
builder
public static <T> ServerSentEvent.Builder<T> builder(T data)
Return a builder for aSseEvent
, populated with the give data.- 类型参数:
T
- the type of data that this event contains- 返回:
- the builder