Package-level declarations

Types

Link copied to clipboard

An adapter similar to WebSocketListenerFlowAdapter, but with an unlimited buffer and non-suspending callback functions. This is useful for bridging implementations that do not support backpressure (like the browser WebSocket API).

Link copied to clipboard
interface WebSocketClient

A web socket client.

Link copied to clipboard

Web socket close codes as defined in the WebSocket Protocol specification.

Link copied to clipboard

Represents a web socket connection to another endpoint.

Link copied to clipboard

An exception thrown when the server closed the connection unexpectedly during the handshake.

Link copied to clipboard
open class WebSocketConnectionException(val url: String, val httpStatusCode: Int? = null, val additionalInfo: String? = null, message: String = defaultMessage(url, httpStatusCode, additionalInfo), cause: Throwable? = null) : WebSocketException

An exception thrown when something went wrong during the web socket connection.

Link copied to clipboard
open class WebSocketException(message: String, cause: Throwable? = null) : Exception

An exception thrown when something went wrong at web socket level.

Link copied to clipboard
sealed class WebSocketFrame

A web socket frame.

Link copied to clipboard
class WebSocketListenerFlowAdapter(bufferSize: Int = Channel.BUFFERED, onBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND)

Adapter between listener calls and a web socket "incoming" frames flow. This is to make it easier to bridge listener-based APIs with the flow-based API of Krossbow. Methods of this listener never fail, but can send failure through the frames channel to the consumers.

Properties

Link copied to clipboard

The maximum number of UTF-8 bytes allowed by the web socket protocol for the "reason" in close frames. This limit is defined in section 5.5 of the RFC-6455.

Functions

Link copied to clipboard

Truncates this string to 123 bytes (CLOSE_REASON_MAX_LENGTH_BYTES), for it to be suitable as web socket close reason.

Link copied to clipboard

Returns the biggest prefix of this string that can be represented with at most maxLength UTF-8 bytes.