KtorWebSocketConnection

class KtorWebSocketConnection(session: WebSocketSession, val remote: Endpoint, val peerIdentity: PeerIdentity = PeerIdentity.None) : MessageConnection(source)

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.

RFC 8323 §4.4: WebSocket Ping frames SHOULD NOT be used; give the session no ping interval, CoAP's own Ping and Pong test the connection. Construct it for a session whose subprotocol is coap.

Constructors

Link copied to clipboard
constructor(session: WebSocketSession, remote: Endpoint, peerIdentity: PeerIdentity = PeerIdentity.None)

Properties

Link copied to clipboard
open override val peerIdentity: PeerIdentity
Link copied to clipboard
open override val remote: Endpoint

Functions

Link copied to clipboard
open suspend override fun close()
Link copied to clipboard
open suspend override fun receive(): ByteArray?
Link copied to clipboard
open suspend override fun send(message: ByteArray)
Link copied to clipboard
open override fun toString(): String