Class SseSerializer

All Implemented Interfaces:
Function<Object,String>, ThrowingFunction<Object,String>, RecordWritable

public class SseSerializer extends WriterSerializer implements RecordWritable
Serializes SseEvent objects to the text/event-stream wire format defined by the WHATWG Server-Sent Events spec.
Media types

Produces Content-Type types: text/event-stream.

Description

Accepts any of the following as input and emits one wire event per element followed by a blank line (the spec's "dispatch" boundary):

After each event is written, the session calls Writer.flush() so that downstream REST infrastructure flushes the underlying TCP socket and the event is delivered immediately to the client.

Notes:
  • This class is thread safe and reusable.
See Also: