It's the Inter-App Communications API, aka IAC.  See:
https://wiki.mozilla.org/WebAPI/Inter_App_Communication_Alt_proposal
https://bugzilla.mozilla.org/show_bug.cgi?id=876397

My impression of it is that it was a stop-gap mechanism that is intended to be obsoleted by service workers or navigator.connect (https://github.com/mkruisselbrink/navigator-connect) or something like that, but I'm sure others can speak to it better.

Andrew

On 09/10/2015 06:36 AM, Augustin Trancart wrote:
Hi there,

Inspecting some gaia app manifests, I came across a 'connections' fields in the SMS app [1]:

  "connections": {
    "costcontrolSmsQuery": {
      "description": "Communicate between Usage and Sms",
      "rules": {
        "manifestURLs": [
"app://costcontrol.gaiamobile.org/manifest.webapp"
        ]
      }
    }
  },

but there is no such field listed in the app manifest documentation on the MDN[2]. Seeing the code, this 'costcontrolSmsQuery' is present on the sms[3] and in costcontrol[4] apps.

The costcontrol code uses DOMApplication.connect, but I can't find any reference to this method in the documentation[5].

For the sms code, the only reference I can get is from the Navigator.mozSetMessageHandler mdn page[6] that tells me you can register handlers for 'connection' system messages. This 'costcontrolSmsQuery' seems to end as a keyword in the request, but I don't understand how this relate to this kind of inter-app communication process (the permission required for setting a message handler on 'connection' messages is 'mobileconnection', seems more like network stuff right?).

I more or less understand what it is doing (and why):
- the connections field describes the connection your app will accept, eg which system messages it will listen to? (but what about the 'messages' field of the manifest then?) - app.connect allows you to connect to applications that have declared this connection. - for reasons still unclear to me, the receiving apps get the message as a 'connection' system message.

It is correct? Is is possible to have a more formal explanation in the documentation? What are the required permission level to use this in gaia apps?

Thanks!

--
Augustin Trancart
Phoxygen

[1] https://github.com/mozilla-b2g/gaia/blob/v2.2/apps%2Fsms%2Fmanifest.webapp#L78
[2] https://developer.mozilla.org/en-US/Apps/Build/Manifest
[3] https://github.com/mozilla-b2g/gaia/blob/v2.2/apps%2Fsms%2Fjs%2Fsilent_sms.js#L22 [4] https://github.com/mozilla-b2g/gaia/blob/v2.2/apps%2Fcostcontrol%2Fjs%2Fiac_manager.js#L2
[5] https://developer.mozilla.org/en-US/docs/Web/API/DOMApplication
[6] https://developer.mozilla.org/en-US/docs/Web/API/Navigator/mozSetMessageHandler


_______________________________________________
dev-fxos mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-fxos

_______________________________________________
dev-fxos mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-fxos

Reply via email to