externally_connectable

The externally_connectable manifest property declares which extensions, apps, and web pages can connect to your {{platform}} via runtime.connect and runtime.sendMessage.

For a tutorial on message passing see cross-extension and app messaging and sending messages from web pages.

Connecting without externally_connectable

If externally_connectable is not declared in your {{platform}}'s manifest, all extensions and apps can connect, but no webpages can connect. As a consequence, when updating your manifest to use externally_connectable, if "ids": ["*"] is not specified then other extensions and apps will lose the ability to connect to your {{platform}}. This may be an unintended consequence, so keep it in mind.

Sample manifest.json

{
  "name": "My externally connectable {{platform}}",
  "externally_connectable": {
    // Extension and app IDs. If this field is not specified, no extensions or
    // apps can connect.
    "ids": [
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
      ...
      // Alternatively, to match all extensions and apps, specify only "*".
      "*"
    ],
    // Match patterns for web pages. Does not affect content scripts. If this
    // field is not specified, no webpages can connect.
    "matches": [
      "https://*.google.com",
      "*://*.chromium.org",
      ...
    ],
    // Indicates that the extension would like to make use of the TLS channel
    // ID of the web page connecting to it. The web page must also opt to send
    // the TLS channel ID to the extension via setting
    // includeTlsChannelId to true in
    // $ref:runtime.connect's connectInfo or $ref:runtime.sendMessage's options.
    "accepts_tls_channel_id": false
  },
  ...
}

Reference

{{+partials.type type:apis.manifestTypes.byName.ExternallyConnectable/}}