Confirmed users
1,340
edits
No edit summary |
|||
| (8 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
= Description = | = Description = | ||
This proposal is just a tweaked version of the [https://wiki.mozilla.org/WebAPI/Inter_App_Communication Inter App Communication API]. Its description, | This proposal is just a tweaked version of the [https://wiki.mozilla.org/WebAPI/Inter_App_Communication Inter App Communication API]. Its description, intent, and use cases do not defer from the previous proposal, only the API does. See [https://bugzilla.mozilla.org/show_bug.cgi?id=876397 bug 876397] for implementation. | ||
= API = | = API = | ||
| 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'. | ||
** ''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 41: | Line 39: | ||
'rules': { | 'rules': { | ||
'minimumAccessLevel': 'web', | 'minimumAccessLevel': 'web', | ||
'installOrigins': ['install_origin_1', 'install_origin_n'] | |||
'installOrigins': ['install_origin_1', 'install_origin_n' | |||
} | } | ||
}, | }, | ||
| Line 62: | 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'. | ||
** ''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 136: | Line 127: | ||
where it advertises itself as able to receive connections through the 'musictrack' keyword, requested by apps installed from the Firefox Marketplace and handled within the ''musicmanager.html'' page. | where it advertises itself as able to receive connections through the 'musictrack' keyword, requested by apps installed from the Firefox Marketplace and handled within the ''musicmanager.html'' page. | ||
On the other side, the Gaia Music app that wants to be controlled from the lockscreen (and only from there) should add the following ' | On the other side, the Gaia Music app that wants to be controlled from the lockscreen (and only from there) should add the following 'connections' field to its manifest: | ||
{ | { | ||
'name': 'Music', | 'name': 'Music', | ||
| Line 144: | Line 135: | ||
'description': 'Play, pause and stop music tracks', | 'description': 'Play, pause and stop music tracks', | ||
'rules': { | 'rules': { | ||
} | } | ||
} | } | ||
| Line 222: | 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) { | ||
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 260: | Line 248: | ||
'Do you want to allow ''System'' (system.gaiamobile.org) to communicate with ''Music'' (music.gaiamobile.org) to ''Play, pause and stop music tracks''? [Accept|Reject]' | 'Do you want to allow ''System'' (system.gaiamobile.org) to communicate with ''Music'' (music.gaiamobile.org) to ''Play, pause and stop music tracks''? [Accept|Reject]' | ||
Even if ''Songbirdy'' and ''iTunos'' advertise themselves as able to connect through the 'musicremotecontrol' keyword, as the request is done with a specific rule that requires the | Even if ''Songbirdy'' and ''iTunos'' advertise themselves as able to connect through the 'musicremotecontrol' keyword, as the request is done with a specific rule that requires the subscriber to have the 'music.gaiamobile.org' origin, these apps won't be listed in the above UI and won't receive any system message with a connection request. | ||
The user allows that connection and a system message is sent to the Music app. | The user allows that connection and a system message is sent to the Music app. | ||
| Line 292: | 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]] | |||