-
-
Method Summary
Modifier and Type Method Description final Context
ctx()
final Boolean
terminated()
Returns true if close has been called. final Unit
keepAlive()
By blocking SSE connection, you can share client outside the handler to notify it from other sources. final Unit
onClose(Runnable closeCallback)
Add a callback that will be called either when connection is closed through close, or when the emitter is detected as closed. Unit
close()
Close the SseClient final Unit
sendEvent(Object data)
Calls sendEvent with event set to "message" final Unit
sendEvent(String event, Object data, String id)
Attempt to send an event. final Unit
sendEvent(String event, Object data)
Attempt to send an event. final Unit
sendComment(String comment)
Attempt to send a comment. -
-
Method Detail
-
terminated
final Boolean terminated()
Returns true if close has been called. This can either be by user, or by Javalin upon detecting that the emitter is closed.
-
keepAlive
final Unit keepAlive()
By blocking SSE connection, you can share client outside the handler to notify it from other sources. Keep in mind that this function is based on top of the Context.future, so you can't use any result function in this scope anymore.
-
onClose
final Unit onClose(Runnable closeCallback)
Add a callback that will be called either when connection is closed through close, or when the emitter is detected as closed.
-
sendEvent
@JvmOverloads() final Unit sendEvent(String event, Object data, String id)
Attempt to send an event. If the emitter fails to emit (remote client has disconnected), the close function will be called instead.
-
sendEvent
@JvmOverloads() final Unit sendEvent(String event, Object data)
Attempt to send an event. If the emitter fails to emit (remote client has disconnected), the close function will be called instead.
-
sendComment
final Unit sendComment(String comment)
Attempt to send a comment. If the emitter fails to emit (remote client has disconnected), the close function will be called instead.
-
-
-
-