Package jakarta.ws.rs.sse
Interface Sse
-
public interface Sse
Server-side entry point for creatingOutboundSseEvent
andSseBroadcaster
.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
- Author:
- Marek Potociar (marek.potociar at oracle.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description SseBroadcaster
newBroadcaster()
Get a new Server-sent event broadcaster.default OutboundSseEvent
newEvent(String data)
Create newOutboundSseEvent
from provided data.default OutboundSseEvent
newEvent(String name, String data)
Create newOutboundSseEvent
from provided data and name.OutboundSseEvent.Builder
newEventBuilder()
Get a new outbound event builder.
-
-
-
Method Detail
-
newEventBuilder
OutboundSseEvent.Builder newEventBuilder()
Get a new outbound event builder.- Returns:
- SSE outbound event builder.
-
newEvent
default OutboundSseEvent newEvent(String data)
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
default OutboundSseEvent newEvent(String name, String data)
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.
-
-