Architecture
How Stream Dock communicates with plugins.
Stream Dock software loads all custom plugins when the application starts. The WebSocket API allows bidirectional communication between plugins and the Stream Dock application using JSON.
Plugin Registration
Each plugin communicates with the Stream Dock application via a dedicated WebSocket on a port specified by the Stream Dock application. Plugins must follow the registration process for this communication to work correctly.
Key Events
A single instance of a plugin runs in the Stream Dock application, even if multiple keys contain the same action provided by the plugin. Once registered, the plugin will be able to send and receive events, such as keyDown and keyUp events.
Cross-Platform
Stream Dock supports cross-platform plugins for Windows and macOS. Besides supporting a JavaScript SDK, there are also third-party plugin libraries for many other programming languages.
Plugins
Plugins consist of four elements:
Manifest: Describes the plugin (name, author, icon, etc.) and defines actions.
Code: The code executed at startup, when a key is pressed, etc.
Property Inspector: The user interface displayed when a key is selected in the canvas.
Assets: Images, localization, etc.
Plugin Unique Identifier
Each plugin has a unique identifier used to identify the plugin in the Stream Dock store. The unique identifier must be a Uniform Type Identifier (UTI) containing only lowercase alphanumeric characters (a-z, 0-9), hyphens (-), and periods (.). The string must be in reverse DNS format. For example, if your domain is hotspotek.com and you create a plugin called text, you could specify the string com.hotspotek.text as the plugin's unique identifier.
Plugin Instance
Each plugin has a single instance. All keys added to the canvas will use different contexts to send events to that single plugin instance.
Actions
A plugin can describe multiple actions in its manifest. For example, the plugin has six actions: Scene, Record, Screenshot, Flashback Recording, Stream, Live Commentary, all listed in manifest.js.
Coordinates
Events can provide the coordinates of the keys on the canvas. With these coordinates, groups of keys can have additional functionalities.
Context
Each instance of an action has a context used by the Stream Dock application to locate the action.
Property Inspector
The plugin and the Property Inspector run independently of each other. Both should register with the Stream Dock application using the registration process and can communicate with the Stream Dock application using a dedicated WebSocket. Several APIs are available for exchanging data between the plugin and the Property Inspector:
When the Property Inspector is shown, the current settings for the selected action are passed directly to the Property Inspector in the inActionInfo parameter. The Property Inspector can use this information to display the current settings in its UI.
You can use the setSettings API to permanently save the settings for an action instance. The plugin will also automatically receive a didReceiveSettings callback with the new settings.
You can use the setGlobalSettings API to save some data globally for the plugin (third-party access keys, user settings, etc.). When the plugin uses setGlobalSettings, the Property Inspector will automatically receive a didReceiveGlobalSettings callback with the new global settings. Similarly, when the Property Inspector uses this API, the plugin will automatically receive a didReceiveGlobalSettings callback.
If you need to pass internal data from the plugin to the Property Inspector, you can use the sendToPropertyInspector API.
Similarly, if you need to pass internal data from the Property Inspector to the plugin, you can use the sendToPlugin API.