Package org.springframework.http.codec
Interface ServerSentEvent.Builder<T>
- Type Parameters:
T- the type of data that this event contains
- Enclosing class:
- ServerSentEvent<T>
public static interface ServerSentEvent.Builder<T>
A mutable builder for a
SseEvent.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the event.Set SSE comment.Set the value of thedatafield.Set the value of theeventfield.Set the value of theidfield.Set the value of theretryfield.
-
Method Details
-
id
Set the value of theidfield.- Parameters:
id- the value of the id field- Returns:
thisbuilder
-
event
Set the value of theeventfield.- Parameters:
event- the value of the event field- Returns:
thisbuilder
-
retry
Set the value of theretryfield.- Parameters:
retry- the value of the retry field- Returns:
thisbuilder
-
comment
Set SSE comment. If a multi-line comment is provided, it will be turned into multiple SSE comment lines as defined in Server-Sent Events W3C recommendation.- Parameters:
comment- the comment to set- Returns:
thisbuilder
-
data
Set the value of thedatafield. If thedataargument is a multi-lineString, it will be turned into multipledatafield lines as defined in the Server-Sent Events W3C recommendation. Ifdatais not a String, it will be encoded into JSON.- Parameters:
data- the value of the data field- Returns:
thisbuilder
-
build
ServerSentEvent<T> build()Builds the event.- Returns:
- the built event
-