Table of Contents

Class NodeOptions

Namespace
Nyra
Assembly
Nyra.dll

Behavioral options of a Node.

public sealed record NodeOptions : IEquatable<NodeOptions>
Inheritance
NodeOptions
Implements
Inherited Members

Properties

MaxReconnectAttempts

Consecutive reconnect attempts before giving up, negative means unlimited.

public int MaxReconnectAttempts { get; init; }

Property Value

int

MaxReconnectDelay

Upper bound of the reconnect delay, the wait is jittered first and then capped here, so a reconnecting client never waits longer than this bound, except that every wait is floored at one millisecond.

public TimeSpan MaxReconnectDelay { get; init; }

Property Value

TimeSpan

Name

The node's display name, used in logs and error messages, must not be blank.

public string Name { get; init; }

Property Value

string

ReadyTimeout

How long the server may take to send ready after the websocket connected.

public TimeSpan ReadyTimeout { get; init; }

Property Value

TimeSpan

Remarks

A node that takes longer is torn down and retried by the reconnect loop, so an edge proxy that completes the upgrade against a dead origin fails the connect instead of leaving it (and every node after it in a serial ConnectAllNodesAsync) waiting forever on a perfectly healthy socket.

The same budget also bounds the pre-connect REST probe (GET /v4/info) and the websocket upgrade itself (TCP, TLS and the HTTP upgrade handshake), each phase with its own full share. Tightening it for fast detection of a dead node also tightens the upgrade on a slow link.

ReconnectDelay

Delay before the first reconnect attempt, doubles with every failed attempt.

public TimeSpan ReconnectDelay { get; init; }

Property Value

TimeSpan

Remarks

Every wait is jittered by ±20% before the cap applies, so the actual wait may be up to 20% shorter or longer than the configured value. With MaxReconnectDelay set equal to this value the wait never exceeds the configuration and can run 20% below it.

A sub-millisecond value would degenerate the backoff into a zero-delay retry loop, so the delay is floored at one millisecond.

ResumeTimeout

How long the server keeps a disconnected resumable session alive.

public TimeSpan ResumeTimeout { get; init; }

Property Value

TimeSpan

Remarks

Only used while Resuming is enabled, with resuming disabled the server drops the session on disconnect and this value is never read past validation. The wire form is whole seconds, a fraction is truncated.

Resuming

When enabled, the session is marked resumable and the session id is replayed on reconnect.

public bool Resuming { get; init; }

Property Value

bool

VoiceHandshakeTimeout

How long to wait for Discord's voice state and voice server updates before a handshake fails.

public TimeSpan VoiceHandshakeTimeout { get; init; }

Property Value

TimeSpan

Remarks

The same bound also covers the gateway sends of the join and leave voice updates (a stuck gateway fails the handshake even while the updates are still pending). It also sizes the window in which a late echo of a compensatory leave is absorbed, so a longer timeout tolerates later echoes.