Interface ServerSentEventBuilder
-
public interface ServerSentEventBuilderA server sent event builder.The builder maintains references to provided byte bufs. It is important to always
build()the event and ultimately ensure that the returned event is released.- Since:
- 1.10
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ServerSentEventbuild()Builds the event.ServerSentEventBuildercomment(io.netty.buffer.ByteBuf comment)Specify a comment to include as part of this event.default ServerSentEventBuildercomment(java.lang.String comment)Specify a comment to include as part of this event.ServerSentEventBuilderdata(io.netty.buffer.ByteBuf data)Specify the event data for the server sent event.default ServerSentEventBuilderdata(java.lang.String data)Specify the event data for the server sent event.ServerSentEventBuilderevent(io.netty.buffer.ByteBuf event)Specify the event type for the server sent event.default ServerSentEventBuilderevent(java.lang.String event)Specify the event type for the server sent event.ServerSentEventBuilderid(io.netty.buffer.ByteBuf id)Specify the event ID for the server sent event.default ServerSentEventBuilderid(java.lang.String id)Specify the event ID for the server sent event.ServerSentEventBuilderunsafeCommentLines(java.util.List<io.netty.buffer.ByteBuf> comment)Specify a comment to include as part of this event.ServerSentEventBuilderunsafeDataLines(java.util.List<io.netty.buffer.ByteBuf> data)Specify the event data for the server sent event.
-
-
-
Method Detail
-
id
ServerSentEventBuilder id(io.netty.buffer.ByteBuf id)
Specify the event ID for the server sent event.The value must be a UTF-8 string that does not contain any newline characters.
- Parameters:
id- the event ID- Returns:
- this
-
id
default ServerSentEventBuilder id(java.lang.String id)
Specify the event ID for the server sent event.The value must not contain any newline characters.
- Parameters:
id- the event ID- Returns:
- this
-
event
ServerSentEventBuilder event(io.netty.buffer.ByteBuf event)
Specify the event type for the server sent event.The value must be a UTF-8 string that does not contain any newline characters.
- Parameters:
event- the event type- Returns:
- this
-
event
default ServerSentEventBuilder event(java.lang.String event)
Specify the event type for the server sent event.The value must not contain any newline characters.
- Parameters:
event- the event type- Returns:
- this
-
data
ServerSentEventBuilder data(io.netty.buffer.ByteBuf data)
Specify the event data for the server sent event.The value must be a UTF-8 string.
- Parameters:
data- the event data- Returns:
- this
-
data
default ServerSentEventBuilder data(java.lang.String data)
Specify the event data for the server sent event.The value must be a UTF-8 string.
- Parameters:
data- the event data- Returns:
- this
-
unsafeDataLines
ServerSentEventBuilder unsafeDataLines(java.util.List<io.netty.buffer.ByteBuf> data)
Specify the event data for the server sent event.The value must be a list of UTF-8 strings where no value contains a newline. This value is not validated. If any list element contains a newline character, the server sent event stream will be malformed.
- Parameters:
data- the event data- Returns:
- this
-
comment
ServerSentEventBuilder comment(io.netty.buffer.ByteBuf comment)
Specify a comment to include as part of this event.- Parameters:
comment- the comment data- Returns:
- this
-
comment
default ServerSentEventBuilder comment(java.lang.String comment)
Specify a comment to include as part of this event.- Parameters:
comment- the comment data- Returns:
- this
-
unsafeCommentLines
ServerSentEventBuilder unsafeCommentLines(java.util.List<io.netty.buffer.ByteBuf> comment)
Specify a comment to include as part of this event.The value must be a list of UTF-8 strings where no value contains a newline. This value is not validated. If any list element contains a newline character, the server sent event stream will be malformed.
- Parameters:
comment- the comment data- Returns:
- this
-
build
ServerSentEvent build()
Builds the event.- Returns:
- the built event
-
-