Ende.QuicConn

interface ยท experimental

interface Ende.QuicConn

UNSTABLE: New API, yet to be vetted.

Properties

endpoint

readonly endpoint: QuicEndpoint

The endpoint for this connection.

handshake

readonly handshake: Promise<void>

Returns a promise that resolves when the TLS handshake is complete.

remoteAddr

readonly remoteAddr: NetAddr

Return the remote address for the connection. Clients may change addresses at will, for example when switching to a cellular internet connection.

protocol

readonly protocol: string | undefined

The negotiated ALPN protocol, if provided. Only available after the handshake is complete.

serverName

readonly serverName: string | undefined

The negotiated server name. Only available on the server after the handshake is complete.

closed

readonly closed: Promise<QuicCloseInfo>

Returns a promise that resolves when the connection is closed.

incomingBidirectionalStreams

readonly incomingBidirectionalStreams: ReadableStream<QuicBidirectionalStream>

A stream of bidirectional streams opened by the peer.

incomingUnidirectionalStreams

readonly incomingUnidirectionalStreams: ReadableStream<QuicReceiveStream>

A stream of unidirectional streams opened by the peer.

maxDatagramSize

readonly maxDatagramSize: number

Returns the datagram stream for sending and receiving datagrams.

Methods

close

close(info?: QuicCloseInfo): void

Close closes the listener. Any pending accept promises will be rejected with errors.

createBidirectionalStream

createBidirectionalStream(options?: QuicSendStreamOptions): Promise<QuicBidirectionalStream>

Opens and returns a bidirectional stream.

createUnidirectionalStream

createUnidirectionalStream(options?: QuicSendStreamOptions): Promise<QuicSendStream>

Opens and returns a unidirectional stream.

sendDatagram

sendDatagram(data: Uint8Array): Promise<void>

Send a datagram. The provided data cannot be larger than maxDatagramSize.

readDatagram

readDatagram(): Promise<Uint8Array<ArrayBuffer>>

Receive a datagram.