Package-level declarations

Types

Link copied to clipboard
class KtorWebSocketConnection(session: WebSocketSession, val remote: Endpoint, val peerIdentity: PeerIdentity = PeerIdentity.None) : MessageConnection

A ktor WebSocket session as a MessageConnection for coap+ws and coaps+ws (RFC 8323 §4), for a client session or a server one. Every CoAP message is one binary frame (§4.2); a fragmented message is reassembled. A text frame is a protocol error that closes the WebSocket with 1003, and the connection reports its end.

Link copied to clipboard

Opens WebSockets for coap+ws and coaps+ws (RFC 8323 §4, §8.3, §8.4) with the ktor client, so the same code runs wherever a ktor engine does. The default client runs on CIO on the JVM and Linux, on Darwin (URLSession, which brings up the cellular radio and honours VPN On Demand) on Apple, and on the runtime's own WebSocket in JS and Wasm. It names that engine, so another ktor engine the application links does not replace it; pass an HttpClient for a different one. The opening handshake asks for the subprotocol coap at /.well-known/coap (§4.1) and fails unless the server selects it.