Connect+Documentation
ExtensionsAPI reference

connect.channel

Cross-extension named-channel pub/sub, gated by a { channel } grant on both ends.

Named-channel pub/sub between different extensions. This is the one cross-extension surface (everything in connect.runtime is intra-extension only). Delivery is per-profile; the publisher never hears its own publish; there are no replies (fire-and-forget).

  • Capability: { channel: "<name>" }both publisher and every subscriber need the matching grant
  • Namespace: connect.channel
{ "capabilities": [{ "channel": "connectDemo" }] }

Channel names match [a-z][a-zA-Z0-9]*.

Walkthrough

Coordinate two of your own extensions.

  1. Grant the same channel — add { "channel": "connectDemo" } to the capabilities of both manifests.
  2. Subscribe in one extension.
  3. Publish from the other.
  4. Remember it's fire-and-forget — layer your own ids for request/response.
// Extension B — subscribe
const off = connect.channel.subscribe('connectDemo', (data) => handle(data));

// Extension A — publish (B receives it; A never hears its own publish)
connect.channel.publish('connectDemo', { hello: 'world' });

Methods

channel.publish(name, data)

Broadcast a message to every subscriber of a channel (except yourself).

How to use it

  1. Hold { channel: name } in your manifest.
  2. Call publish(name, data); subscribers in the same profile receive it.

Signatureconnect.channel.publish(name, data)

Parameters

ParameterTypeRequiredDescription
namestringyesThe channel; you must hold { channel: name }.
dataunknownyesJSON-serialisable payload.

ReturnsPromise<void>.

channel.subscribe(name, cb)

Listen on a channel.

How to use it

  1. Hold { channel: name }.
  2. Subscribe; cb(data) runs for each message from another extension.
  3. Keep the returned function to unsubscribe.

Signatureconnect.channel.subscribe(name, cb)

Parameters

ParameterTypeRequiredDescription
namestringyesThe channel; you must hold { channel: name }.
cbfunctionyescb(data) for each message from another extension.

Returns — an unsubscribe function.

// Extension B
const off = connect.channel.subscribe('connectDemo', (data) => handle(data));
// Extension A
connect.channel.publish('connectDemo', { hello: 'world' });

Notes

  • Both ends need the same { channel } grant — a subscriber without it hears nothing; a publisher without it is denied.
  • Fire-and-forget: no acknowledgement or reply. For request/response, layer your own correlation ids on top.

On this page