Space Plugin SDKSpace Plugin SDK
Home
Overview
  • 中文简体
  • English
Home
Overview
  • 中文简体
  • English
  • SDK

    • Overview
    • Getting Started
    • Terminology
    • Architecture
    • Manifest
    • Internationalization
    • Received Events
    • Events Sent
    • Registration Procedure
    • Property Inspector
    • Style Guide
    • Changelog
  • Example

    • Counter
    • Timer
    • Number Display
    • Time
  • Support

    • Help and Error Reporting

Registration Procedure

How Plugins Connect to Stream Dock

Plugin Registration

Plugins must follow the registration procedure outlined below. You can reuse the code implemented in various examples. We provide this process in JavaScript, but you can use any programming language that supports WebSocket to implement it. When the Stream Dock application starts, it creates an instance of each plugin.

  • For JavaScript plugins, use multiple parameters to call connectElgatoStreamDeckSocket(). To ensure compatibility with Elgato, we use the same function names as theirs so that your plugin can be compatible with Elgato software.

  • For plugins packaged as .exe files, use multiple parameters to launch the .exe executable file.

These parameters include port and unique identifiers used to communicate with the Stream Dock application.

JavaScript Plugin Registration

For JavaScript plugins, you need to declare the following JavaScript functions:

// To ensure compatibility with Elgato,
// we use the same function names as theirs, 
// so your developed plugin can be compatible with Elgato software.
function connectElgatoStreamDeckSocket(
    inPort, 
    inPluginUUID, 
    inRegisterEvent, 
    inInfo
)

This function is called when the plugin is loaded and should:

  • Create a WebSocket using the provided port parameter:
const server = new WebSocket('ws://127.0.0.1:' + inPort);
  • When the WebSocket opens, the plugin needs to send a registration event
server.onopen = () => server.send(
    JSON.stringify({ event: inRegisterEvent, uuid: inPluginUUID });
);
  • After completing the above two steps, the plugin should receive events through the following function:
server.onmessage = (e) => (
    console.log(e.data);
);

Plugin Registration for Compiled Executables

For plugins packaged as .exe, you will start the .exe executable with the following parameters:

ParameterDescription
-portThe string "-port"
portThe port used for connecting to the WebSocket
-pluginUUIDThe string "-pluginUUID"
pluginUUIDA unique identifier string used to register the plugin after opening the WebSocket
-registerEventThe string "-registerEvent"
eventThe event type applied to register the plugin after opening the WebSocket
-infoThe string "-info"
infoA JSON string containing Stream Dock and device information

PropertyInspector Registration

For the Property Inspector, you need to declare the following JavaScript functions:

// To ensure compatibility with Elgato,
// we use the same function names as theirs, 
// so your developed plugin can be compatible with Elgato software.
function connectElgatoStreamDeckSocket(
    inPort,
    inPropertyInspectorUUID, 
    inRegisterEvent, 
    inInfo, 
    inActionInfo
)
ParameterDescription
inPortThe port used for connecting to the WebSocket
inPropertyInspectorUUIDThe unique identifier string used to register the Property Inspector after opening the WebSocket
inRegisterEventThe event type applied to register the Property Inspector after opening the WebSocket
inInfoA JSON object containing information about the application
inActionInfoA JSON object containing information about the action

This function is called when displaying the Property Inspector and should:

  • Create a WebSocket using the provided port parameter:
const server = new WebSocket('ws://127.0.0.1:' + inPort);
  • When the WebSocket opens, the Property Inspector needs to register JSON data
server.onopen = () => server.send(
    JSON.stringify({ event: inRegisterEvent, uuid: inPropertyInspectorUUID });
);
  • After performing the above two steps, the Property Inspector should receive events via the following function:
server.onmessage = (e) => (
    console.log(e.data);
);

info

The JSON objects used in the registration process are as follows:

{
    "application":{
        "font":"HarmonyOS Sans",
        "language":"zh_CN",
        "platform":"windows",
        "platformVersion":"10.0.19045",
        "version":"4.9"
    },
    "colors":{
        "buttonMouseOverBackgroundColor":"#464646FF",
        "buttonPressedBackgroundColor":"#303030FF",
        "buttonPressedBorderColor":"#646464FF",
        "buttonPressedTextColor":"#969696FF",
        "highlightColor":"#0078FFFF"
    },
    "devicePixelRatio":1,
    "devices":[
        {
            "id": "55F16B35884A859CCE4FFA1FC8D3DE5B", 
            "name": "Device Name", 
            "size": {
                "columns": 5, 
                "rows": 3
            }, 
            "type": 0
            },
            {
            "id": "B8F04425B95855CF417199BCB97CD2BB", 
            "name": "Another Device", 
            "size": {
                "columns": 3, 
                "rows": 2
            }, 
            "type": 1
        }
    ],
    "plugin":{
        "uuid":"com.mirabox.demo",
        "version":"1.8"
    }
}
ParameterDescription
applicationA JSON object containing information about the application
colorsA JSON object containing color information
devicesA JSON array containing information about devices
pluginA JSON object containing information about the plugin
devicePixelRatioThe pixel ratio indicating whether the Stream Dock application is running on a HiDPI screen

Application Object

The application object contains the following members:

applicationDescription
languageThe language of the application
platformThe platform on which the application is running
platformVersionThe version of the platform
versionThe version of the application

Plugin Object

The plugin object contains the following members:

pluginDescription
uuidThe unique identifier of the plugin
versionThe version of the plugin

Devices Array

The devices array contains the following members:

devicesDescription
idThe unique identifier of the device
nameThe name of the device
sizeThe size of the device
typeThe type of the device

inActionInfo

The inActionInfo parameter is a JSON string that contains the following information:

{
  "action": "com.mirabox.demo.action1", 
  "context": uniqueValue, 
  "device": uniqueValue, 
  "payload": {
    "settings": {<JSON data>},
    "controller": "Keypad" | "Encoder"
    "coordinates": {
      "column": 2, 
      "row": 1
    }
  }
}
ParameterDescription
actionThe unique identifier of the action defined in the plugin
contextA value used to identify the instance of the action
deviceA value used to identify the device
payloadA JSON object

Payload Object

The payload object contains the following members:

payloadDescription
settingsA JSON object containing persistently stored data
controllerAn array of controllers. Valid values include Keypad, Information, SecondaryScreen, Knob. Keypad is for regular keys, Information is for display only without touch or key events, SecondaryScreen is for small screen display, and Knob is for the rotary knob. Default is ["Keypad"].
coordinatesThe coordinates of the triggered action
Last Updated:
Contributors: Heart
Prev
Events Sent
Next
Property Inspector