Package starfederation.datastar.utils
Class ServerSentEventGenerator
java.lang.Object
starfederation.datastar.utils.ServerSentEventGenerator
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes the Server-Sent Event generator. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the writer when finished.voidsend(AbstractDatastarEvent event) Sends a Datastar event to the client with a monotonically increasing long ID and default retry duration.voidsend(AbstractDatastarEvent event, int retry) Sends a Datastar event to the client with a monotonically increasing long ID and specified retry duration.voidsend(AbstractDatastarEvent event, String id) Sends a Datastar event to the client with a specified ID and default retry duration.voidsend(AbstractDatastarEvent event, String id, int retry) Sends a Datastar event to the client.
-
Constructor Details
-
ServerSentEventGenerator
Initializes the Server-Sent Event generator.- Parameters:
response- the response adapter to send the event to.
-
-
Method Details
-
send
Sends a Datastar event to the client.- Parameters:
event- the event to sendid- the event id
-
send
Sends a Datastar event to the client with a monotonically increasing long ID and default retry duration.- Parameters:
event- the event to send
-
send
Sends a Datastar event to the client with a specified ID and default retry duration.- Parameters:
event- the event to sendid- the event id
-
send
Sends a Datastar event to the client with a monotonically increasing long ID and specified retry duration.- Parameters:
event- the event to sendretry- the retry duration
-
close
public void close()Closes the writer when finished.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-