T
- the type of data that this event containspublic static interface ServerSentEvent.Builder<T>
SseEvent
.Modifier and Type | Method and Description |
---|---|
ServerSentEvent<T> |
build()
Builds the event.
|
ServerSentEvent.Builder<T> |
comment(String comment)
Set SSE comment.
|
ServerSentEvent.Builder<T> |
data(T data)
Set the value of the
data field. |
ServerSentEvent.Builder<T> |
event(String event)
Set the value of the
event field. |
ServerSentEvent.Builder<T> |
id(String id)
Set the value of the
id field. |
ServerSentEvent.Builder<T> |
retry(Duration retry)
Set the value of the
retry field. |
ServerSentEvent.Builder<T> id(String id)
id
field.id
- the value of the id fieldthis
builderServerSentEvent.Builder<T> event(String event)
event
field.event
- the value of the event fieldthis
builderServerSentEvent.Builder<T> retry(Duration retry)
retry
field.retry
- the value of the retry fieldthis
builderServerSentEvent.Builder<T> comment(String comment)
comment
- the comment to setthis
builderServerSentEvent.Builder<T> data(@Nullable T data)
data
field. If the data
argument is a multi-line
String
, it will be turned into multiple data
field lines as defined
in the Server-Sent Events W3C recommendation. If data
is not a String, it will
be encoded into JSON.data
- the value of the data fieldthis
builderServerSentEvent<T> build()