ConnectionInterface

An active QUIC connection to a remote endpoint.

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract suspend fun acceptBi(): BiStream

Accept the next incoming bidirectional stream.

Link copied to clipboard
abstract suspend fun acceptUni(): RecvStream

Accept the next incoming unidirectional stream.

Link copied to clipboard
abstract fun alpn(): ByteArray

The ALPN protocol negotiated for this connection.

Link copied to clipboard
abstract fun close(errorCode: Long, reason: ByteArray)

Close the connection immediately with the given application error code.

Link copied to clipboard
abstract suspend fun closed(): String

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

Link copied to clipboard
abstract fun closeReason(): String?

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

Link copied to clipboard

Bytes available in the datagram send buffer.

Link copied to clipboard
abstract fun maxDatagramSize(): ULong?

Maximum size of a datagram that can currently be sent.

Link copied to clipboard
abstract suspend fun openBi(): BiStream

Open a new bidirectional outgoing stream.

Link copied to clipboard
abstract suspend fun openUni(): SendStream

Open a new unidirectional outgoing stream.

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

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

Link copied to clipboard
abstract suspend fun readDatagram(): ByteArray

Read the next datagram from the connection.

Link copied to clipboard
abstract fun remoteId(): EndpointId

The `EndpointId` of the remote peer.

Link copied to clipboard
abstract 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
abstract fun sendDatagram(data: ByteArray)

Send a datagram on this connection.

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

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

Link copied to clipboard
abstract fun setMaxConcurrentBiStreams(count: ULong)

Set the maximum number of concurrent incoming bidirectional streams.

Link copied to clipboard
abstract fun setMaxConcurrentUniStreams(count: ULong)

Set the maximum number of concurrent incoming unidirectional streams.

Link copied to clipboard
abstract fun setReceiveWindow(count: ULong)

Set the receive window for this connection.

Link copied to clipboard
abstract fun side(): Side

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

Link copied to clipboard
abstract fun stableId(): ULong

A stable identifier for this connection.

Link copied to clipboard
abstract fun stats(): ConnectionStats

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

Link copied to clipboard

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

Link copied to clipboard
abstract 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.