Property Inspector (UI)
The property inspector (UI) connects to Stream Deck using a WebSocket, allowing it to directly receive a subset of events, and send commands. The WebSocket connection also allows the property inspector to communicate with the application-layer (i.e. the plugin).
Registration
- Manually
- Automatically
A connection with Stream Deck is established within the property inspector by defining a function on the window, named connectElgatoStreamDeckSocket. Once the DOM has loaded, Stream Deck will invoke this function and provide registration information, including the port to connect on.
Below is an example of implementing the connectElgatoStreamDeckSocket function to establish a connection with Stream Deck:
window.connectElgatoStreamDeckSocket = (port, uuid, event, info, actionInfo) => {
const infoObj = JSON.parse(info); // Information about Stream Deck and the plugin.
const actionInfo = JSON.parse(actionInfo); // Information about the action the UI is for.
// Establish a connection with Stream Deck
const connection = new WebSocket(`ws://127.0.0.1:${port}`);
connection.onopen = () => {
connection.send(JSON.stringify({ event, uuid }));
};
};Registration within the property inspector is automatically managed by sdpi-components, and a Stream Deck Client is available to make communicating with Stream Deck easy. For example.
SDPIComponents
.streamDeckClient
.getGlobalSettings()
.then((settings) => {
console.log(settings);
});connectElgatoStreamDeckSocket
Connects to the Stream Deck, enabling the UI to interact with the plugin, and access the Stream Deck API.
window.connectElgatoStreamDeckSocket = (port: string, uuid: string, event: string, info: string, actionInfo: string) => void | Promise<void>Parameters
| Name | Description |
|---|---|
| port | Port to be used when connecting to Stream Deck. |
| uuid | Identifies the UI; this must be provided when establishing the connection with Stream Deck. |
| event | Name of the event that identifies the registration procedure; this must be provided when establishing the connection with Stream Deck. |
| info | Information about the Stream Deck application and operating system. |
| actionInfo | Information about the action the UI is associated with. |
RegistrationInfo
Information about the Stream Deck application, the plugin, the user's operating system, user's Stream Deck devices, etc.
type RegistrationInfo = {
application: {
font: string;
language: "de" | "en" | "es" | "fr" | "ja" | "ko" | "zh_CN" | "zh_TW";
platform: "mac" | "windows";
platformVersion: string;
version: string;
};
colors: {
buttonMouseOverBackgroundColor: string;
buttonPressedBackgroundColor: string;
buttonPressedBorderColor: string;
buttonPressedTextColor: string;
highlightColor: string;
};
devicePixelRatio: number;
devices: {
id: string;
name: string;
size: {
columns: number;
rows: number;
};
type: DeviceType;
}[];
plugin: {
uuid: string;
version: string;
};
};application: objectRequired
Stream Deck application specific information.
font: stringRequired
Font being used by the Stream Deck application.
language: "de" | "en" | "es" | "fr" | "ja" | "ko" | "zh_CN" | "zh_TW"Required
Users preferred language; this is used by the Stream Deck application for localization.
platform: "mac" | "windows"Required
Operating system.
platformVersion: stringRequired
Operating system version, e.g. "10" for Windows 10.
version: stringRequired
Stream Deck application version.
colors: objectRequired
Collection of preferred colors used by the Stream Deck.
buttonMouseOverBackgroundColor: stringRequired
Color that denotes the background of a button that is being moused over.
buttonPressedBackgroundColor: stringRequired
Color that denotes the background of a pressed button.
buttonPressedBorderColor: stringRequired
Color that denotes the border of a press button.
buttonPressedTextColor: stringRequired
Color that denotes the text of a pressed button.
highlightColor: stringRequired
Color of highlighted text.
devicePixelRatio: numberRequired
Pixel ratio, used to identify if the Stream Deck application is running on a high DPI screen.
devices: object[]Required
Devices associated with the Stream Deck application; this may include devices that are not currently connected. Use "deviceDidConnect" event to determine which devices are active.
plugin: objectRequired
Information about the plugin.
uuid: stringRequired
Unique identifier of the plugin, as defined by the plugin.
version: stringRequired
Version of the plugin.
Events
DidReceiveGlobalSettings
Occurs when the settings associated with the plugin are requested, or when the the plugin's settings were updated by the plugin.
type DidReceiveGlobalSettings = {
event: "didReceiveGlobalSettings";
payload: {
settings: JsonObject;
};
};event: "didReceiveGlobalSettings"Required
Name of the event.
payload: objectRequired
Additional information about the event.
settings: JsonObjectRequired
Global settings associated with this plugin.