WebAPI/Inter App Communication Alt proposal: Difference between revisions

no edit summary
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 25: Line 25:
* ''rules'' (optional) is an object containing a set of constraints for the requested connection. Only apps fulfilling these constraints will receive a connection request. These rules may contain:
* ''rules'' (optional) is an object containing a set of constraints for the requested connection. Only apps fulfilling these constraints will receive a connection request. These rules may contain:
** ''minimumAccessLevel'' is the minimum level of access (one of https://developer.mozilla.org/en-US/docs/Web/Apps/Manifest#type) that the subscriber app requires in order to be able to receive the connection request. The default value will be 'web'.
** ''minimumAccessLevel'' is the minimum level of access (one of https://developer.mozilla.org/en-US/docs/Web/Apps/Manifest#type) that the subscriber app requires in order to be able to receive the connection request. The default value will be 'web'.
** ''developers'' (array) list of objects identifying app authors whose apps are allowed to receive a connection request.
** ''installOrigins'' (array) list of install origins from where subscriber apps should have been installed. Since certified apps has not a ''valid'' install origin, these constraint does not apply to them.
** ''installOrigins'' (array) list of install origins from where subscriber apps should have been installed. Since certified apps has not a ''valid'' install origin, these constraint does not apply to them.


Line 40: Line 39:
         'rules': {
         'rules': {
           'minimumAccessLevel': 'web',
           'minimumAccessLevel': 'web',
          'manifestURLs': ['manifestURL_1', 'manifestURL_n'],
           'installOrigins': ['install_origin_1', 'install_origin_n']
           'installOrigins': ['install_origin_1', 'install_origin_n'],
          'developers': [{
            'name': 'developer_name',
            'url': 'developer_url'
          }]
         }
         }
       },
       },
Line 61: Line 55:
* ''rules'' is an object containing a set of constraints to be fulfilled by connection requesters. These rules may contain:
* ''rules'' is an object containing a set of constraints to be fulfilled by connection requesters. These rules may contain:
** ''minimumAccessLevel'' is the minimum level of access (one of https://developer.mozilla.org/en-US/docs/Web/Apps/Manifest#type) that the requester app requires in order to be able to send a connection request. The default value will be 'web'.
** ''minimumAccessLevel'' is the minimum level of access (one of https://developer.mozilla.org/en-US/docs/Web/Apps/Manifest#type) that the requester app requires in order to be able to send a connection request. The default value will be 'web'.
** ''manifestURLs'' (array) can be used to set specific requesters by a list of manifestURLs.
** ''developers'' (array) list of objects identifying app authors whose apps are allowed to send connection requests.
** ''installOrigins'' (array) list of install origins from where the requester apps should have been installed. Since certified apps has not a ''valid'' install origin, these constraint does not apply to them.
** ''installOrigins'' (array) list of install origins from where the requester apps should have been installed. Since certified apps has not a ''valid'' install origin, these constraint does not apply to them.


Line 143: Line 135:
         'description': 'Play, pause and stop music tracks',
         'description': 'Play, pause and stop music tracks',
         'rules': {
         'rules': {
          'manifestURLs': ['app://system.gaiamobile.org/manifest.webapp']
         }
         }
       }
       }
Line 221: Line 212:
The lockscreen, in this example, wants to control '''only''' (no reasons, just an example) the music from the Gaia Music app (known origin). Once the lockscreen is ready, it sends a connection request of this kind:
The lockscreen, in this example, wants to control '''only''' (no reasons, just an example) the music from the Gaia Music app (known origin). Once the lockscreen is ready, it sends a connection request of this kind:


  connect('musicremotecontrol', {
  connect('musicremotecontrol').then((function onConnectionAccepted(ports) {
  manifestURLs: ['app://music.gaiamobile.org/manifest.webapp']
}).then((function onConnectionAccepted(ports) {
   if (ports.length > 1) {
   if (ports.length > 1) {
     // We shouldn't be here as we only want to communicate with the Gaia Music app.
     // We shouldn't be here as we only want to communicate with the Gaia Music app.
Line 291: Line 280:


* We might want to have a bigger set of types to allow apps to connect (web, installed, signed, privileged, certified).
* We might want to have a bigger set of types to allow apps to connect (web, installed, signed, privileged, certified).
[[Category:Web APIs]]
Confirmed users
1,340

edits