open class SseEmitter : ResponseBodyEmitter
A specialization of ResponseBodyEmitter for sending Server-Sent Events.
Author
Rossen Stoyanchev
Author
Juergen Hoeller
Since
4.2
SseEmitter()
Create a new SseEmitter instance. SseEmitter(timeout: Long)
Create a SseEmitter with a custom timeout value. By default not set in which case the default configured in the MVC Java Config or the MVC namespace is used, or if that's not set, then the timeout depends on the default of the underlying server. |
open static fun event(): SseEventBuilder |
|
open fun send(object: Any): Unit
Send the object formatted as a single SSE "data" line. It's equivalent to:
open fun send(object: Any, mediaType: MediaType): Unit
Send the object formatted as a single SSE "data" line. It's equivalent to:
open fun send(builder: SseEventBuilder): Unit
Send an SSE event prepared with the given builder. For example:
|
|
open fun toString(): String |
open fun complete(): Unit
Complete request processing. A dispatch is made into the app server where Spring MVC completes asynchronous request processing. |
|
open fun completeWithError(ex: Throwable): Unit
Complete request processing with an error. A dispatch is made into the app server where Spring MVC will pass the exception through its exception handling mechanism. |
|
open fun getTimeout(): Long
Return the configured timeout value, if any. |
|
open fun onCompletion(callback: Runnable): Unit
Register code to invoke when the async request completes. This method is called from a container thread when an async request completed for any reason including timeout and network error. This method is useful for detecting that a |
|
open fun onError(callback: Consumer<Throwable>): Unit
Register code to invoke for an error during async request processing. This method is called from a container thread when an error occurred while processing an async request. |
|
open fun onTimeout(callback: Runnable): Unit
Register code to invoke when the async request times out. This method is called from a container thread when an async request times out. |