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.
- Grant the same channel — add
{ "channel": "connectDemo" }to thecapabilitiesof both manifests. - Subscribe in one extension.
- Publish from the other.
- 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
- Hold
{ channel: name }in your manifest. - Call
publish(name, data); subscribers in the same profile receive it.
Signature — connect.channel.publish(name, data)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | The channel; you must hold { channel: name }. |
data | unknown | yes | JSON-serialisable payload. |
Returns — Promise<void>.
channel.subscribe(name, cb)
Listen on a channel.
How to use it
- Hold
{ channel: name }. - Subscribe;
cb(data)runs for each message from another extension. - Keep the returned function to unsubscribe.
Signature — connect.channel.subscribe(name, cb)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | The channel; you must hold { channel: name }. |
cb | function | yes | cb(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.