Package-level declarations

Types

Link copied to clipboard

A client session for handling Server-Sent Events (SSE) from a server.

Link copied to clipboard

A client session with deserialization support for handling Server-Sent Events (SSE) from a server.

Link copied to clipboard
Link copied to clipboard

Indicates if a client engine supports Server-Sent Events (SSE).

Link copied to clipboard
class SSEClientContent(val reconnectionTime: Duration, val showCommentEvents: Boolean, val showRetryEvents: Boolean, val maxReconnectionAttempts: Int, val callContext: CoroutineContext, val initialRequest: HttpRequestBuilder, requestBody: OutgoingContent) : OutgoingContent.ContentWrapper
Link copied to clipboard
class SSEClientException(val response: HttpResponse? = null, val cause: Throwable? = null, val message: String? = null) : IllegalStateException

Represents an exception which can be thrown during client SSE session.

Link copied to clipboard
class SSEConfig

A config for the SSE plugin.

Link copied to clipboard
interface SSESession : CoroutineScope

A session for handling Server-Sent Events (SSE) from a server.

Link copied to clipboard
interface SSESessionWithDeserialization : CoroutineScope

A session with deserialization support for handling Server-Sent Events (SSE) from a server.

Properties

Link copied to clipboard

Client Server-Sent Events (SSE) plugin that allows you to establish an SSE connection to a server and receive Server-Sent Events from it. For a simple session, use ClientSSESession. For a session with deserialization, use ClientSSESessionWithDeserialization.

Functions

Link copied to clipboard

Deserialize the provided event data into an object of type T using the deserializer function defined in the SSESessionWithDeserialization interface.

Deserialize the provided data into an object of type T using the deserializer function defined in the SSESessionWithDeserialization interface.

Link copied to clipboard
suspend fun HttpClient.serverSentEvents(request: HttpRequestBuilder.() -> Unit, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: suspend ClientSSESession.() -> Unit)
suspend fun HttpClient.serverSentEvents(urlString: String, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, request: HttpRequestBuilder.() -> Unit = {}, block: suspend ClientSSESession.() -> Unit)
suspend fun HttpClient.serverSentEvents(scheme: String? = null, host: String? = null, port: Int? = null, path: String? = null, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, request: HttpRequestBuilder.() -> Unit = {}, block: suspend ClientSSESession.() -> Unit)

Opens a ClientSSESession to receive Server-Sent Events (SSE) from a server and performs block.

suspend fun HttpClient.serverSentEvents(request: HttpRequestBuilder.() -> Unit, deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: suspend ClientSSESessionWithDeserialization.() -> Unit)

Opens a ClientSSESessionWithDeserialization to receive Server-Sent Events (SSE) from a server with ability to deserialize the data field of the TypedServerSentEvent.

suspend fun HttpClient.serverSentEvents(urlString: String, deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, request: HttpRequestBuilder.() -> Unit = {}, block: suspend ClientSSESessionWithDeserialization.() -> Unit)
suspend fun HttpClient.serverSentEvents(scheme: String? = null, host: String? = null, port: Int? = null, path: String? = null, deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, request: HttpRequestBuilder.() -> Unit = {}, block: suspend ClientSSESessionWithDeserialization.() -> Unit)

Opens a ClientSSESessionWithDeserialization to receive Server-Sent Events (SSE) from a server with ability to deserialize the data field of the TypedServerSentEvent and performs block.

Link copied to clipboard
suspend fun HttpClient.serverSentEventsSession(reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit): ClientSSESession
suspend fun HttpClient.serverSentEventsSession(urlString: String, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit = {}): ClientSSESession
suspend fun HttpClient.serverSentEventsSession(scheme: String? = null, host: String? = null, port: Int? = null, path: String? = null, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit = {}): ClientSSESession

Opens a ClientSSESession to receive Server-Sent Events (SSE) from a server.

suspend fun HttpClient.serverSentEventsSession(deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit): ClientSSESessionWithDeserialization
suspend fun HttpClient.serverSentEventsSession(urlString: String, deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit = {}): ClientSSESessionWithDeserialization
suspend fun HttpClient.serverSentEventsSession(scheme: String? = null, host: String? = null, port: Int? = null, path: String? = null, deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit = {}): ClientSSESessionWithDeserialization

Opens a ClientSSESessionWithDeserialization to receive Server-Sent Events (SSE) from a server with ability to deserialize the data field of the TypedServerSentEvent.

Link copied to clipboard
fun HttpClientConfig<*>.SSE(config: SSEConfig.() -> Unit)

Installs the SSE plugin using the config as configuration.

Link copied to clipboard
suspend fun HttpClient.sse(request: HttpRequestBuilder.() -> Unit, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: suspend ClientSSESession.() -> Unit)
suspend fun HttpClient.sse(urlString: String, request: HttpRequestBuilder.() -> Unit = {}, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: suspend ClientSSESession.() -> Unit)
suspend fun HttpClient.sse(scheme: String? = null, host: String? = null, port: Int? = null, path: String? = null, request: HttpRequestBuilder.() -> Unit = {}, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: suspend ClientSSESession.() -> Unit)

Opens a ClientSSESession to receive Server-Sent Events (SSE) from a server and performs block.

suspend fun HttpClient.sse(request: HttpRequestBuilder.() -> Unit, deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: suspend ClientSSESessionWithDeserialization.() -> Unit)
suspend fun HttpClient.sse(urlString: String, request: HttpRequestBuilder.() -> Unit = {}, deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: suspend ClientSSESessionWithDeserialization.() -> Unit)
suspend fun HttpClient.sse(scheme: String? = null, host: String? = null, port: Int? = null, path: String? = null, request: HttpRequestBuilder.() -> Unit = {}, deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: suspend ClientSSESessionWithDeserialization.() -> Unit)

Opens a ClientSSESessionWithDeserialization to receive Server-Sent Events (SSE) from a server with ability to deserialize the data field of the TypedServerSentEvent and performs block.

Link copied to clipboard
suspend fun HttpClient.sseSession(reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit): ClientSSESession
suspend fun HttpClient.sseSession(urlString: String, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit = {}): ClientSSESession
suspend fun HttpClient.sseSession(scheme: String? = null, host: String? = null, port: Int? = null, path: String? = null, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit = {}): ClientSSESession

Opens a ClientSSESession to receive Server-Sent Events (SSE) from a server.

suspend fun HttpClient.sseSession(deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit): ClientSSESessionWithDeserialization
suspend fun HttpClient.sseSession(urlString: String, deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit = {}): ClientSSESessionWithDeserialization
suspend fun HttpClient.sseSession(scheme: String? = null, host: String? = null, port: Int? = null, path: String? = null, deserialize: (TypeInfo, String) -> Any?, reconnectionTime: Duration? = null, showCommentEvents: Boolean? = null, showRetryEvents: Boolean? = null, block: HttpRequestBuilder.() -> Unit = {}): ClientSSESessionWithDeserialization

Opens a ClientSSESessionWithDeserialization to receive Server-Sent Events (SSE) from a server with ability to deserialize the data field of the TypedServerSentEvent and performs block.