Connection

An active QUIC connection to a remote endpoint.

Functions

Link copied to clipboard
open suspend override fun acceptBi(): BiStream

Accept the next incoming bidirectional stream.

Link copied to clipboard
open suspend override fun acceptUni(): RecvStream

Accept the next incoming unidirectional stream.

Link copied to clipboard
open override fun alpn(): ByteArray

The ALPN protocol negotiated for this connection.

Link copied to clipboard
open override fun close()

open override fun close(errorCode: Long, reason: ByteArray)

Close the connection immediately with the given application error code.

Link copied to clipboard
open suspend override fun closed(): String

Wait for the connection to be closed, returning the cause.

Link copied to clipboard
open override fun closeReason(): String?

If the connection is closed, the reason why. None if still open.

Link copied to clipboard
open override fun datagramSendBufferSpace(): ULong

Bytes available in the datagram send buffer.

Link copied to clipboard
open override fun destroy()
Link copied to clipboard
open override fun maxDatagramSize(): ULong?

Maximum size of a datagram that can currently be sent.

Link copied to clipboard
open suspend override fun openBi(): BiStream

Open a new bidirectional outgoing stream.

Link copied to clipboard
open suspend override fun openUni(): SendStream

Open a new unidirectional outgoing stream.

Link copied to clipboard
open override fun paths(): List<PathSnapshot>

A snapshot of all currently open network paths for this connection.

Link copied to clipboard
open suspend override fun readDatagram(): ByteArray

Read the next datagram from the connection.

Link copied to clipboard
open override fun remoteId(): EndpointId

The `EndpointId` of the remote peer.

Link copied to clipboard
open override fun rtt(): ULong?

Current best estimate of this connection's RTT on the selected path, in milliseconds. None if no path is currently selected.

Link copied to clipboard
open override fun sendDatagram(data: ByteArray)

Send a datagram on this connection.

Link copied to clipboard
open suspend override fun sendDatagramWait(data: ByteArray)

Like `Connection::send_datagram` but waits for capacity if the send buffer is full.

Link copied to clipboard
open override fun setMaxConcurrentBiStreams(count: ULong)

Set the maximum number of concurrent incoming bidirectional streams.

Link copied to clipboard
open override fun setMaxConcurrentUniStreams(count: ULong)

Set the maximum number of concurrent incoming unidirectional streams.

Link copied to clipboard
open override fun setReceiveWindow(count: ULong)

Set the receive window for this connection.

Link copied to clipboard
open override fun side(): Side

Which side of the connection we are (client or server).

Link copied to clipboard
open override fun stableId(): ULong

A stable identifier for this connection.

Link copied to clipboard
open override fun stats(): ConnectionStats

A flat snapshot of the most useful headline statistics for this connection.

Link copied to clipboard
open override fun watchPathEvents(callback: PathEventCallback): WatchHandle

Register a callback that fires for each individual path event (path opened, closed, selected, or lagged).

Link copied to clipboard
open override fun watchPaths(callback: PathChangeCallback): WatchHandle

Register a callback that fires with the current set of open paths whenever the path list (or selected path) changes.