Ende.Listener
interface
interface Ende.Listener<T extends Conn = Conn, A extends Addr = Addr> extends AsyncIterable<T>, DisposableA generic network listener for stream-oriented protocols.
Properties
addr
readonly addr: AReturn the address of the Listener.
Methods
accept
accept(): Promise<T>Waits for and resolves to the next connection to the Listener.
close
close(): voidClose closes the listener. Any pending accept promises will be rejected
with errors. A pending async iterator next() call will settle after the
underlying accept promise is rejected.
If the listener has a pending accept operation, the underlying socket may
not be released until the pending promise is rejected. If you need to
listen on the same address immediately after closing the listener, await
the pending accept promise before calling Ende.listen again.
[Symbol.asyncIterator]
[Symbol.asyncIterator](): AsyncIterableIterator<T>Iterates over the connections accepted by the listener.
ref
ref(): voidMake the listener block the event loop from finishing.
Note: the listener blocks the event loop from finishing by default.
This method is only meaningful after .unref() is called.
unref
unref(): voidMake the listener not block the event loop from finishing.