IMultiplexedConnection
Defined in: packages/net-core/src/multiplexed-connection.ts:182
A secure connection carrying many independent streams (QUIC).
Neither a Transport nor a TransportConnection: a protocol over it opens and accepts streams rather than reading one byte stream. The negotiated details mirror TransportConnection so a protocol layer reads them the same way.
Extends
Section titled “Extends”IEventDispatcherMap<MultiplexedConnectionEvents>
Properties
Section titled “Properties”alpnProtocol
Section titled “alpnProtocol”
readonlyalpnProtocol:string|null
Defined in: packages/net-core/src/multiplexed-connection.ts:193
The application protocol ALPN settled on, or null when none was.
closed
Section titled “closed”
readonlyclosed:boolean
Defined in: packages/net-core/src/multiplexed-connection.ts:196
Whether the connection ended; openStream then rejects.
readonlylocal:TransportEndpoint|null
Defined in: packages/net-core/src/multiplexed-connection.ts:184
The local end, or null when the carrier has no addresses.
remote
Section titled “remote”
readonlyremote:TransportEndpoint|null
Defined in: packages/net-core/src/multiplexed-connection.ts:187
The remote end, or null when the carrier has no addresses.
secure
Section titled “secure”
readonlysecure:boolean
Defined in: packages/net-core/src/multiplexed-connection.ts:190
Whether the bytes are protected by TLS (always, over QUIC).
Methods
Section titled “Methods”close()
Section titled “close()”close(
code,reason?):Promise<void>
Defined in: packages/net-core/src/multiplexed-connection.ts:218
Close the connection gracefully with an application code: streams still
open fail, and the peer learns code and reason. Idempotent.
Parameters
Section titled “Parameters”number
Application error code.
reason?
Section titled “reason?”string
Human-readable reason.
Returns
Section titled “Returns”Promise<void>
Resolves once the connection ended.
destroy()
Section titled “destroy()”destroy(
error?):void
Defined in: packages/net-core/src/multiplexed-connection.ts:225
Tear the connection down at once with the connection’s generic abort code.
Parameters
Section titled “Parameters”error?
Section titled “error?”unknown
Optional cause, carried by the close event’s error.
Returns
Section titled “Returns”void
isSubscribed()
Section titled “isSubscribed()”isSubscribed<
K>(event,listener):boolean
Defined in: packages/async/src/events/ievent-dispatcher-map.ts:41
Check if a callback is subscribed to a specific event.
Type Parameters
Section titled “Type Parameters”K extends keyof MultiplexedConnectionEvents
Parameters
Section titled “Parameters”K
The event name.
listener
Section titled “listener”Callable<MultiplexedConnectionEvents[K]>
The callback to check.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”IEventDispatcherMap.isSubscribed
openStream()
Section titled “openStream()”openStream(
direction,signal?):Promise<IMultiplexedStream>
Defined in: packages/net-core/src/multiplexed-connection.ts:205
Open a stream.
Parameters
Section titled “Parameters”direction
Section titled “direction”Whether the peer may send on it too.
signal?
Section titled “signal?”AbortSignal
Abandons the wait.
Returns
Section titled “Returns”Promise<IMultiplexedStream>
The stream, once the peer allows one more in that direction.
subscribe()
Section titled “subscribe()”subscribe<
K>(event,listener,options?):Callable|null
Defined in: packages/async/src/events/ievent-dispatcher-map.ts:18
Type Parameters
Section titled “Type Parameters”K extends keyof MultiplexedConnectionEvents
Parameters
Section titled “Parameters”K
listener
Section titled “listener”Callable<MultiplexedConnectionEvents[K]>
options?
Section titled “options?”EventDispatcherSubscribeOptions
Returns
Section titled “Returns”Callable | null
Inherited from
Section titled “Inherited from”IEventDispatcherMap.subscribe
unsubscribe()
Section titled “unsubscribe()”unsubscribe<
K>(event,listener):void
Defined in: packages/async/src/events/ievent-dispatcher-map.ts:30
Unsubscribe a callback from a specific event.
Type Parameters
Section titled “Type Parameters”K extends keyof MultiplexedConnectionEvents
Parameters
Section titled “Parameters”K
The event name.
listener
Section titled “listener”Callable<MultiplexedConnectionEvents[K]>
The callback to remove.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”IEventDispatcherMap.unsubscribe
wait()
Section titled “wait()”wait<
K>(event,options?):Promise<MultiplexedConnectionEvents[K]>
Defined in: packages/async/src/events/ievent-dispatcher-map.ts:58
Wait for the next occurrence of a specific event, optionally matching a predicate.
This is a convenience method that subscribes to the dispatcher, waits for the next event that matches the predicate (if provided), and then unsubscribes automatically.
Type Parameters
Section titled “Type Parameters”K extends keyof MultiplexedConnectionEvents
Parameters
Section titled “Parameters”K
The event name to wait for.
options?
Section titled “options?”EventDispatcherWaitOptions<MultiplexedConnectionEvents[K]>
Optional settings including predicate and abort signal.
Returns
Section titled “Returns”Promise<MultiplexedConnectionEvents[K]>
A promise that resolves with the event arguments as an array.
Inherited from
Section titled “Inherited from”IEventDispatcherMap.wait