Package io.ktor.client.plugins.websocket

Types

Link copied to clipboard
interface ClientWebSocketSession : WebSocketSession

Client specific WebSocketSession.

Link copied to clipboard
Link copied to clipboard
object WebSocketCapability : HttpClientEngineCapability<Unit>

Indicates if a client engine supports WebSockets.

Link copied to clipboard
class WebSocketException(message: String) : IllegalStateException
Link copied to clipboard
object WebSocketExtensionsCapability : HttpClientEngineCapability<Unit>

Indicates if a client engine supports extensions for WebSocket plugin.

Link copied to clipboard
class WebSockets

Client WebSocket plugin.

Functions

Link copied to clipboard
inline suspend fun <T : Any> DefaultClientWebSocketSession.receiveDeserialized(): T

Dequeues a frame and deserializes it to the type T using WebSocket content converter. May throw an exception WebsocketDeserializeException if the converter can't deserialize frame data to type T. May throw WebsocketDeserializeException if the received frame type is not Frame.Text or Frame.Binary. In this case, WebsocketDeserializeException.frame contains the received frame. May throw ClosedReceiveChannelException if a channel was closed

Link copied to clipboard
inline suspend fun <T : Any> DefaultClientWebSocketSession.sendSerialized(data: T)

Serializes data to a frame and enqueues this frame. May suspend if the outgoing queue is full. If the outgoing channel is already closed, throws an exception, so it is impossible to transfer any message. Frames sent after a Close frame are silently ignored. Note that a Close frame could be sent automatically in reply to a peer's Close frame unless it is a raw WebSocket session.

Link copied to clipboard
suspend fun HttpClient.webSocket(request: HttpRequestBuilder.() -> Unit, block: suspend DefaultClientWebSocketSession.() -> Unit)
suspend fun HttpClient.webSocket(urlString: String, request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit)
suspend fun HttpClient.webSocket(method: HttpMethod = HttpMethod.Get, host: String? = null, port: Int? = null, path: String? = null, request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit)
Link copied to clipboard
fun HttpClientConfig<*>.WebSockets(config: WebSockets.Config.() -> Unit)

Installs the WebSockets plugin using the config as configuration.

Link copied to clipboard
suspend fun HttpClient.webSocketSession(block: HttpRequestBuilder.() -> Unit): DefaultClientWebSocketSession
suspend fun HttpClient.webSocketSession(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): DefaultClientWebSocketSession
suspend fun HttpClient.webSocketSession(method: HttpMethod = HttpMethod.Get, host: String? = null, port: Int? = null, path: String? = null, block: HttpRequestBuilder.() -> Unit = {}): DefaultClientWebSocketSession
Link copied to clipboard
suspend fun HttpClient.ws(request: HttpRequestBuilder.() -> Unit, block: suspend DefaultClientWebSocketSession.() -> Unit)
suspend fun HttpClient.ws(urlString: String, request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit)
suspend fun HttpClient.ws(method: HttpMethod = HttpMethod.Get, host: String? = null, port: Int? = null, path: String? = null, request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit)
Link copied to clipboard
suspend fun HttpClient.wss(request: HttpRequestBuilder.() -> Unit, block: suspend DefaultClientWebSocketSession.() -> Unit)
suspend fun HttpClient.wss(urlString: String, request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit)
suspend fun HttpClient.wss(method: HttpMethod = HttpMethod.Get, host: String? = null, port: Int? = null, path: String? = null, request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit)

Properties

Link copied to clipboard

Converter for web socket session