Skip to content

Class: Reconnecting<C> ​

Defined in: netconf/src/reconnect.ts:63

An async iterator of connected clients, from reconnecting(): each next() resolves with a new client once the previous one's session has ended. Leave the loop, call return(), or dispose of it (await using) to close the current client and stop.

Type Parameters ​

C ​

C

Implements ​

  • AsyncIterableIterator<C>
  • AsyncDisposable

Accessors ​

current ​

Get Signature ​

ts
get current(): C | undefined;

Defined in: netconf/src/reconnect.ts:89

The client the last next() resolved with, until it is closed by stopping.

Returns ​

C | undefined

Methods ​

[asyncDispose]() ​

ts
[asyncDispose](): Promise<void>;

Defined in: netconf/src/reconnect.ts:119

The same as return(), for await using.

Returns ​

Promise<void>

Implementation of ​

AsyncDisposable.[asyncDispose]


[asyncIterator]() ​

ts
[asyncIterator](): this;

Defined in: netconf/src/reconnect.ts:114

This iterator itself, so for await can use it.

Returns ​

this

Implementation of ​

AsyncIterableIterator.[asyncIterator]


next() ​

ts
next(): Promise<IteratorResult<C, undefined>>;

Defined in: netconf/src/reconnect.ts:101

Wait until the current client's session has ended (at once for the first call), back off, and connect again. Resolves with the new client, or done once stopped.

Returns ​

Promise<IteratorResult<C, undefined>>

Throws ​

the error of a failure that retrying can't fix (authentication, host key, certificate, hello, profile, capability, or any error that isn't transient), or the last error after retry.maxAttempts failures.

Implementation of ​

AsyncIterableIterator.next


return() ​

ts
return(): Promise<IteratorResult<C, undefined>>;

Defined in: netconf/src/reconnect.ts:108

Stop: close the current client and end the iteration.

Returns ​

Promise<IteratorResult<C, undefined>>

Implementation of ​

AsyncIterableIterator.return

Released under the MIT Licence.