public interface Sse
OutboundSseEvent
and SseBroadcaster
.
Instance of this interface can be injected into a field or as a parameter of a method or a constructor. Also, the instance is thread safe, meaning that it can be shared and its method invoked from different threads without causing inconsistent internal state.
Modifier and Type | Method and Description |
---|---|
SseBroadcaster |
newBroadcaster()
Get a new Server-sent event broadcaster.
|
default OutboundSseEvent |
newEvent(java.lang.String data)
Create new
OutboundSseEvent from provided data. |
default OutboundSseEvent |
newEvent(java.lang.String name,
java.lang.String data)
Create new
OutboundSseEvent from provided data and name. |
OutboundSseEvent.Builder |
newEventBuilder()
Get a new outbound event builder.
|
OutboundSseEvent.Builder newEventBuilder()
default OutboundSseEvent newEvent(java.lang.String data)
OutboundSseEvent
from provided data.
The data can be string only and must not be null.
data
- event data.OutboundSseEvent
.java.lang.IllegalArgumentException
- when data is null
.default OutboundSseEvent newEvent(java.lang.String name, java.lang.String data)
OutboundSseEvent
from provided data and name.name
- event name. (see SseEvent.getName()
).data
- event data.OutboundSseEvent
.java.lang.IllegalArgumentException
- when name or data is null
.SseBroadcaster newBroadcaster()