QuicListener
Defined in: net-quic/src/quic-listener.ts:96
Accepts QUIC connections on one UDP socket and yields each, once its handshake completed, as an IMultiplexedConnection.
Every connection shares the socket, so close stops accepting at once
but releases the address only after the last accepted connection ended. A
handshake that fails is reported as error; the listener carries on.
Example
Section titled “Example” const listener = await QuicListener.listen({ host: "127.0.0.1", port: 4433, tls: { certificateChain, privateKey, alpnProtocols: ["h3"] }, transport, maxConnections: 1000, abortCode: 0x102, }); listener.subscribe("connection", (connection) => serve(connection)); ```;
## Extends
- `EventDispatcherMapBase`\<`ListenerEvents`\<`IMultiplexedConnection`\>\>
## Implements
- `IListener`\<`IMultiplexedConnection`\>
## Properties
### local
> `readonly` **local**: `TransportEndpoint`
Defined in: net-quic/src/quic-listener.ts:110
#### Implementation of
`IListener.local`
## Methods
### \[asyncDispose\]()
> **\[asyncDispose\]**(): `Promise`\<`void`\>
Defined in: net-quic/src/quic-listener.ts:168
Closes the listener, so it can be used with `await using`.
#### Returns
`Promise`\<`void`\>
***
### close()
> **close**(): `Promise`\<`void`\>
Defined in: net-quic/src/quic-listener.ts:158
Stop accepting connections.
Already-accepted connections are not affected: they belong to whoeverreceived them. Idempotent.
#### Returns
`Promise`\<`void`\>
Resolves once the listener released its address.
#### Implementation of
`IListener.close`
***
### isSubscribed()
> **isSubscribed**\<`K`\>(`event`, `listener`): `boolean`
Defined in: async/src/events/event-dispatcher-map-base.ts:38
Check if a callback is subscribed to a specific event.
#### Type Parameters
##### K
`K` *extends* keyof `ListenerEvents`\<`IMultiplexedConnection`\>
#### Parameters
##### event
`K`
The event name.
##### listener
`Callable`\<`ListenerEvents`\<`IMultiplexedConnection`\>\[`K`\]\>
The callback to check.
#### Returns
`boolean`
#### Implementation of
`IListener.isSubscribed`
#### Inherited from
`EventDispatcherMapBase.isSubscribed`
***
### subscribe()
> **subscribe**\<`K`\>(`event`, `listener`, `options?`): `Callable` \| `null`
Defined in: async/src/events/event-dispatcher-map-base.ts:23
#### Type Parameters
##### K
`K` *extends* keyof `ListenerEvents`\<`IMultiplexedConnection`\>
#### Parameters
##### event
`K`
##### listener
`Callable`\<`ListenerEvents`\<`IMultiplexedConnection`\>\[`K`\]\>
##### options?
`EventDispatcherSubscribeOptions`
#### Returns
`Callable` \| `null`
#### Implementation of
`IListener.subscribe`
#### Inherited from
`EventDispatcherMapBase.subscribe`
***
### unsubscribe()
> **unsubscribe**\<`K`\>(`event`, `listener`): `void`
Defined in: async/src/events/event-dispatcher-map-base.ts:31
Unsubscribe a callback from a specific event.
#### Type Parameters
##### K
`K` *extends* keyof `ListenerEvents`\<`IMultiplexedConnection`\>
#### Parameters
##### event
`K`
The event name.
##### listener
`Callable`\<`ListenerEvents`\<`IMultiplexedConnection`\>\[`K`\]\>
The callback to remove.
#### Returns
`void`
#### Implementation of
`IListener.unsubscribe`
#### Inherited from
`EventDispatcherMapBase.unsubscribe`
***
### wait()
> **wait**\<`K`\>(`event`, `options?`): `Promise`\<`ListenerEvents`\<`IMultiplexedConnection`\>\[`K`\]\>
Defined in: async/src/events/event-dispatcher-map-base.ts:45
Wait for the next occurrence of a specific event, optionally matching apredicate.
This is a convenience method that subscribes to the dispatcher, waits forthe next event that matches the predicate (if provided), and thenunsubscribes automatically.
#### Type Parameters
##### K
`K` *extends* keyof `ListenerEvents`\<`IMultiplexedConnection`\>
#### Parameters
##### event
`K`
The event name to wait for.
##### options?
`EventDispatcherWaitOptions`\<`ListenerEvents`\<`IMultiplexedConnection`\>\[`K`\]\>
Optional settings including predicate and abort signal.
#### Returns
`Promise`\<`ListenerEvents`\<`IMultiplexedConnection`\>\[`K`\]\>
A promise that resolves with the event arguments as an array.
#### Implementation of
`IListener.wait`
#### Inherited from
`EventDispatcherMapBase.wait`
***
### listen()
> `static` **listen**(`options`): `Promise`\<`QuicListener`\>
Defined in: net-quic/src/quic-listener.ts:130
Bind and start accepting.
#### Parameters
##### options
[`QuicListenOptions`](../type-aliases/QuicListenOptions.md)
Address to bind, TLS and transport limits.
#### Returns
`Promise`\<`QuicListener`\>
The listener, once bound.
#### Throws
When the certificate or key is invalid, the address cannot be bound, or `signal` aborts first.