Connection
Represents an active session to a remote peer. Use it to inspect peer metadata and send payloads.
Properties
peerId
The unique identifier of the connected peer.
val peerId: StringlatencyMs
Best-effort round trip time (RTT) estimate in milliseconds.
val latencyMs: LongMethods
send(data, callback)
Sends a payload to the peer and reports SendResult.
send(data: ByteArray, callback: (SendResult) -> Unit): voidclose()
Closes the connection gracefully.
close(): voidExample
connection.send(payload) { result ->
if (!result.ok) {
log("send failed", result.traceId)
}
}