Creates a TCP server interface.
Protected_Whether a terminal closed event has already been dispatched for the
current connection episode (dedupe guard).
Protected_AbortController for the current reconnect wait, so disconnect() can
cancel an in-flight backoff immediately.
Protected_Reconnect attempt counter for the current drop episode. Reset to 0 at the start of each Interface._runReconnectLoop run.
Protected_Single-flight guard: only one reconnect loop runs at a time.
Whether automatic reconnection is enabled for this initiator interface.
Nominal physical bitrate of this interface in bits per second
(self.bitrate on RNS.Interfaces.Interface in the Python reference,
default 62500). Each interface overrides this with its medium's rate.
Used by TransportCore.prioritizeInterfaces() to order the interface set
highest-bitrate-first (mirrors the Python reference's
Transport.prioritize_interfaces); the per-bitrate link-timeout and
announce-rate-limit behaviours that also build on it are tracked as
Phase 2 of work doc #20. Configured bitrates below
Reticulum.MINIMUM_BITRATE are ignored (matching Python).
Per-dial connect timeout in seconds.
Permanent stop signal read by the reconnect loop. Set by disconnect().
Whether this interface is the initiator (the outbound dialer). Only
initiators reconnect; adopted/server-spawned sockets never do (matching
the Python reference initiator flag).
Maximum reconnection attempts per drop. Infinity retries forever.
Seconds to wait between reconnection attempts.
The underlying socket, when this interface is backed by a Node.js stream.
Protected_Protected
Signals the reconnect loop to stop and cancels any in-flight backoff.
Client subclasses call this at the top of their disconnect().
Protected_Protected
Dispatches a terminal closed event exactly once per connection episode.
Protected_Protected
Dials the peer and sets up the RNS streams, resolving once connected and
dispatching connected. Implemented by reconnect-capable client
subclasses; used both for the initial connection and each reconnect
attempt by the shared Interface._runReconnectLoop.
Protected_Protected
Called when the underlying connection drops (the inbound stream ends or
errors). For an initiator with auto-reconnect enabled and not deliberately
detached, dispatches disconnected and kicks off the reconnect loop;
otherwise dispatches a terminal closed event.
Matches the Python reference read_loop, which reconnects the initiator
on any termination and tears down (non-reconnecting) everyone else.
Protected_Protected
Initializes shared reconnect state from constructor options. Called by client interface subclasses (TCP, WebSocket) that support reconnection.
Subclasses must also set Interface.initiator: true for an
outbound dialer, false for an adopted/server-spawned socket.
Protected_Protected
Runs the single-flight reconnect loop. Repeatedly waits reconnectWait
seconds then attempts to re-establish the connection via the subclass
_establishConnection() hook, until it succeeds, the interface is
detached, or maxReconnectTries is exceeded (terminal closed).
Each attempt fires a reconnecting event with the upcoming attempt
number, the wait, and the cap, for observability. A successful reconnect
fires connected (via _establishConnection).
Protected_Protected
Resolves after ms, or immediately if signal aborts. Used so
disconnect() can cancel an in-flight reconnect backoff at once.
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Optionaloptions: boolean | AddEventListenerOptionsOptional hook invoked by import("../transport/transport.js").TransportCore#addInterface with the transport that owns this interface, right after the interface is attached.
The base implementation is a no-op. Interfaces that spawn sub-interfaces
dynamically — notably AutoInterface, which discovers peers and
spawns one per peer — override it to remember the transport so the spawned
peers can be auto-registered without a separate Reticulum global (the
Python reference uses the global RNS.Transport.add_interface for this).
Overriders should also register any peers spawned before the transport was
attached, so the addInterface/connect call order doesn't matter.
Starts listening on the configured port for inbound connections.
Closes the listening server and disconnects all spawned client interfaces.
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
Optionaloptions: boolean | EventListenerOptionsStaticgetReturns the JSON Schema describing the options accepted by the TCPServerInterface constructor.
A JSON Schema object.
Reticulum interface that listens for inbound TCP connections.
Each accepted connection is exposed as a spawned TCPClientInterface via the
connectionevent.