Appearance
Policy
What it is?
Every plugin should contain a Policy file. The policy file defines what the plugin has access to. It defines what messages the plugin can send and receive.
PlatformHub reads this file from the plugin to validate whether the plugin is eligible to be used with PlatformHub.
Where is it located?
The Policy file lives inside of each plugin.
What is its format?
In both iOS and Android it is a JSON file.
What information does it contain?
- name: Name of the plugin (it should match the implementing class name).
- publish: List of messages the plugin publishes. These messages can only be events:
- EventStream
- subscribeOnStartup: List of messages the plugin wants to be subscribed to automatically on PlatformHub startup. The subscribing plugin will automatically have its
subscribe(toPublisher:...)method invoked by PlatformHub. These messages can only be:- EventStream
- subscribeOnDemand: List of messages a plugin can subscribe to on-demand by invoking
MessageSending.publisher(forEvent:...). These messages can be only be:- EventStream
- send: List of messages the plugin sends. These messages will be received by other plugins. These messages can be:
- Query
- NavigationQuery (aOS) / ViewQuery (iOS)
- Command
- receive: List of messages the plugin receives. These messages will be sent by other plugins. These messages can be:
- Query
- NavigationQuery (aOS) / ViewQuery (iOS)
- Command
- publishToTopic: List of topics the plugin can publish to ny invoking
MessageSending.publishToTopic(...). These messages can be:- TopicStream
- subscribeToTopic: List of topics the plugin can subscribe to by invoking
MessageSending.subscribeToTopic(...). These messages can be:- TopicStream
What is policy schemaVersion?
To make any changes to the policy file non-breaking, schemaVersion key is added to it. It will default to version 1 for the current policy file format. Any new change is added as a different version to prevent breaking the existing policy file. For more details refer to mobile platform specific examples.
Name conventions
Failing to follow the plugin name and message name conventions will make the app crash at launch outputting an explanatory error in the console to inform the developer about the issue.
Mobile platform specific examples
Please read each policy format based on the OS: