Package javax.ws.rs.sse
Interface Sse
public interface Sse
Server-side entry point for creating
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.
- Since:
- 2.1
-
Method Summary
Modifier and TypeMethodDescriptionGet a new Server-sent event broadcaster.default OutboundSseEvent
Create newOutboundSseEvent
from provided data.default OutboundSseEvent
Create newOutboundSseEvent
from provided data and name.Get a new outbound event builder.
-
Method Details
-
newEventBuilder
OutboundSseEvent.Builder newEventBuilder()Get a new outbound event builder.- Returns:
- SSE outbound event builder.
-
newEvent
Create newOutboundSseEvent
from provided data.The data can be string only and must not be null.
- Parameters:
data
- event data.- Returns:
- created
OutboundSseEvent
. - Throws:
IllegalArgumentException
- when data isnull
.
-
newEvent
Create newOutboundSseEvent
from provided data and name.- Parameters:
name
- event name. (seeSseEvent.getName()
).data
- event data.- Returns:
- created
OutboundSseEvent
. - Throws:
IllegalArgumentException
- when name or data isnull
.
-
newBroadcaster
SseBroadcaster newBroadcaster()Get a new Server-sent event broadcaster.- Returns:
- new Server-sent event broadcaster instance.
-