Skip to main content

Module diagnostics_channel

Module diagnostics_channel 

Source
Expand description

Node diagnostics_channel — in-process publish/subscribe named channels.

A channel is a plain object tagged @@native = "Channel" carrying its name (@@name, also exposed as the enumerable name), a hidden @@subs array of subscriber callbacks, and a hasSubscribers data property kept in sync as subscribers come and go. Channels are interned by name in a thread-local registry so channel('x') === channel('x') and the module-level subscribe/unsubscribe/hasSubscribers(name, …) operate on the very same object a caller obtains from channel(name) — matching Node’s guarantee that a channel is a single shared instance per name.

Scope of fidelity: this is an in-process implementation. publish(msg) synchronously invokes each subscriber with (message, channelName) (Node’s contract). It does not span worker threads or processes, and it does not implement the tracingChannel / async-context store surface. The registry is process-lifetime; handles are only meaningful within a single program run (they index the live heap).

Constants§

METHODS
TRACING_CHANNEL_METHODS
Methods dispatched on an @@native = "TracingChannel" object (reported to the parent for instance_has_method / instance_call wiring).

Functions§

call
constant
Non-function members of the diagnostics_channel namespace, exposed as constructor values for instanceof/typeof checks. Reachable via namespace_property IF the parent routes "diagnostics_channel" into stdlib::constant. The channel objects themselves come from channel() / tracingChannel(); these bare constructors are not directly instantiable (Node’s Channel constructor also throws) — they exist so the names resolve.
instance_call
Instance dispatch for a Channel object (@@native = "Channel").
tracing_instance_call
Instance dispatch for a TracingChannel object (@@native = "TracingChannel").