@ChannelHandler.Sharable
public class ServerSentEventEncoder
extends io.netty.channel.ChannelOutboundHandlerAdapter
ServerSentEvent encoding for an HTTP server.
This encoder will encode any ServerSentEvent to ByteBuf and also set the appropriate HTTP Response
headers required for SSE| Constructor and Description |
|---|
ServerSentEventEncoder() |
ServerSentEventEncoder(boolean splitSseData)
Splits the SSE data on new line and create multiple "data" events if
splitSseData is true |
| Modifier and Type | Method and Description |
|---|---|
void |
write(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Object msg,
io.netty.channel.ChannelPromise promise) |
bind, close, connect, deregister, disconnect, flush, readexceptionCaught, handlerAdded, handlerRemoved, isSharablepublic ServerSentEventEncoder()
public ServerSentEventEncoder(boolean splitSseData)
splitSseData is truesplitSseData - true if the SSE data is to be splitted on new line to create multiple "data" events.public void write(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Object msg,
io.netty.channel.ChannelPromise promise)
throws java.lang.Exception
write in interface io.netty.channel.ChannelOutboundHandlerwrite in class io.netty.channel.ChannelOutboundHandlerAdapterjava.lang.Exception