Stream Deck Client
The streamDeckClient
provides a wrapper for sending and receiving messages to and from the Stream Deck. It can be accessed under the SDPIComponents
namespace, e.g.
const streamDeckClient = SDPIComponents.streamDeckClient;
Connection Infoâ
Information supplied to the property inspector as part of the registration procedure can be accessed via getConnectionInfo()
.
(async function () {
const info = await SDPIComponents.streamDeckClient.getConnectionInfo();
})();
Data contained within the connection information includes:
- Available Stream Deck devices.
- The operating system.
- Plugin version and UUID.
- Action name, coordinates, settings, etc.
Global Settingsâ
Get Global Settingsâ
Requests the plugin's global settings, and returns payload as an awaitable promise (see getGlobalSettings
).
getGlobalSettings(): Promise<Record<string, unknown>>;
(async function () {
const settings = await SDPIComponents.streamDeckClient.getGlobalSettings();
})();
Set Global Settingsâ
Sets the plugin's global settings (see setGlobalSettings
).
setGlobalSettings(value: unknown): void;
Received Global Settingsâ
An event that occurs when didReceiveGlobalSetting
is received.
didReceiveGlobalSettings: EventManager<DidReceiveGlobalSettingsEvent>();
type DidReceiveGlobalSettingsEvent = {
event: 'didReceiveGlobalSettings';
payload: {
settings: Record<string, unknown>;
};
};
SDPIComponents.streamDeckClient.didReceiveGlobalSettings.subscribe(console.log);
/*
Upon receiving the global settings, the output would look like this:
{
event: 'didReceiveGlobalSettings',
payload: {
settings: {
foo: 'bar',
lorem: 'ipsum'
}
}
}
*/
Settingsâ
These settings are relative to the action associated with the active property inspector.
Get Settingsâ
Requests the action's settings, and returns the payload as an awaitable promise (see getSettings
)).
getSettings(): Promise<ActionSettingsPayload>
type ActionSettingsPayload = {
coordinates?: {
column: number;
row: number;
};
isInMultiAction: boolean;
settings: Record<string, unknown>;
};
The result maps from the payload
object of getSettings
.
(async function () {
const settings = await SDPIComponents.streamDeckClient.getSettings();
})();
Set Settingsâ
Sets the action's settings (see setSettings
).
setSettings(value: unknown): void
Received Settingsâ
An event that occurs when didReceiveSetting
is received.
didReceiveGlobalSettings: EventManager<DidReceiveSettingsEvent>();
SDPIComponents.streamDeckClient.didReceiveSettings.subscribe(console.log);
/*
Upon receiving the settings, the output would look like this:
{
action: 'com.elgato.sdpi.counter',
context: '3F5021CBD379BF30781CA3EB2516DD23',
device: 'B3F7C6D19695AF13B95578F2C29EB037',
event: 'didReceiveSetting',
payload: {
coordinates: {
column: 1,
row: 1
},
settings: {
bar: 'foo',
ipsum: 'lorem'
}
}
}
*/
Sent to Property Inspectorâ
An event that occurs when sendToPropertyInspector
is received.
sendToPropertyInspector: EventManager<SendToPropertyInspectorEvent>();
SDPIComponents.streamDeckClient.sendToPropertyInspector.subscribe(console.log);
/*
Upon receiving the settings, the output would look like this:
{
action: 'com.elgato.sdpi.counter',
context: '3F5021CBD379BF30781CA3EB2516DD23',
event: 'sendToPropertyInspector'
payload: {
msg: 'Hello world'
}
}
*/
Sendâ
Sends a message to the Stream Deck; the message is automatically associated with the current action.
send<T extends EventSent['event']>(event: T, payload?: unknown): Promise<void>;
(async function () {
const payload = { url: 'https://sdpi-components.dev' };
await SDPIComponents.streamDeckClient.send('openUrl', payload);
})();
Valid values of event
are:
- getSettings
- setSettings
- getGlobalSettings
- setGlobalSettings
- logMessage
- openUrl
- sendToPlugin