Documentation / @super-line/server / PluginChannel
Interface: PluginChannel
Defined in: index.ts:420
A plugin-private adapter channel (reserved x:<plugin>: prefix), fanned out cluster-wide.
Properties
subscribers
readonlysubscribers:number
Defined in: index.ts:433
How many subscribers this channel has on this node, right now.
A plugin that fans out observations needs to know whether anything consumes them, and a plugin-owned connection is observer-invisible — no lifecycle hook fires for it — so a plugin has no other way to notice its consumer arriving or leaving. Node-local by construction: cluster-wide interest is a plugin's own business to gossip, exactly as the inspector does.
Methods
onSubscribersChanged()
onSubscribersChanged(
cb): () =>void
Defined in: index.ts:441
Called when PluginChannel.subscribers changes. Returns an unsubscribe fn.
The edge, not just the level: a plugin that gossips its interest must announce the moment a consumer arrives. Polling the count instead costs a window of silence at the start of every session — long enough, on a live feed, to lose the first events a reader attached in order to see.
Parameters
cb
(count) => void
Returns
() => void
publish()
publish(
data):void
Defined in: index.ts:422
Publish to this channel; delivered to every node's subscribers (local echo included).
Parameters
data
unknown
Returns
void
subscribe()
subscribe(
handler):Unsubscribe
Defined in: index.ts:424
Subscribe to this channel. meta.from is the publishing node. Await .ready before publishing from elsewhere.
Parameters
handler
(data, meta) => void