Events Sent
You can send the following commands to the SDK via WebSocket to control your StreamDock device.
Device Specification Reference
When setting images, please note the specification differences of different devices:
| Device Model | Screen Size | Key Size | Special Description |
|---|---|---|---|
| StreamDock 293 | 800×480 | 100×100 | 15 keys |
| StreamDock 293V3 | 800×480 | 112×112 | 15 keys |
| StreamDock 293s | 800×480 | 100×100 | 15 keys |
| StreamDock N3 | 320×240 | 64×64 | 6 keys |
| StreamDock N4 | 800×480 | 112×112 (keys) / 176×112 (secondary screen) | 15 keys + 4 knobs |
| StreamDock N1 | 480×854 | 96×96 | 17 keys+1 knob |
| StreamDock M3 | 854×480 | 96×96 (keys) / 176×96 (secondary screen) | 15 keys + 4 knobs |
| StreamDock M18 | 480×272 | 64×64 | 18 keys |
| StreamDock XL | 1024×600 | 80×80 | 32 keys + 2 side toggle switches |
| K1Pro | 800×480 | 112×112 | 6 keys + 3 knobs |
Available Commands
| Command | Function Description |
|---|---|
| getFirmVersion | Get device firmware version |
| read | Start listening to device events (keys, knobs, etc.) |
| setBackgroundImg | Set device background image |
| setBackgroundImgData | Set background image via data |
| clearAllIcon | Clear all key icons |
| clearIcon | Clear specified key icon |
| setKeyImg | Set key icon |
| setKeyImgData | Set key icon via data |
| setBrightness | Adjust device brightness |
| refresh | Refresh device display |
| setLEDBrightness | Set LED brightness |
| setLEDColor | Set LED color |
| resetLEDColor | Reset LED color |
| setKeyboardLightingEffects | Set keyboard lighting effects |
| setKeyboardLightingSpeed | Set keyboard lighting speed |
| setKeyboardRGBBacklight | Set keyboard RGB backlight |
| setKeyboardOSMode | Set keyboard OS mode (Win/Mac) |
| setKeyboardBacklightBrightness | Set keyboard backlight brightness |
getFirmVersion
Get device firmware version information.
{
"event": "getFirmVersion",
"path": "Device path"
}
Parameter Description:
event: Fixed as "getFirmVersion"path: Unique device identifier (automatically obtained when device connects)
read
Start listening to device events, such as key presses, knob rotations, etc. It's recommended to send this command immediately after connecting to enable event listening.
{
"event": "read",
"path": "Device path"
}
Parameter Description:
event: Fixed as "read"path: Unique device identifier (automatically obtained when device connects)
Usage Tips:
- Listening will automatically stop when device disconnects
- Need to send this command again after reconnecting device
setBackgroundImg
Set device background image. Please note that different devices support different background image sizes.
{
"event": "setBackgroundImg",
"path": "Device path",
"payload": {
"imagePath": "Image file path"
}
}
Parameter Description:
event: Fixed as "setBackgroundImg"path: Unique device identifierpayload.imagePath: File path of the background image
Important Notes:
- Do not send other commands while setting background image, as this may cause display anomalies
- Need to send
readcommand first to receive notification of successful background setting - Refer to the device specification table above for supported background image sizes for different devices
setBackgroundImgData
Set device background image via image data, suitable for scenarios with dynamically generated images.
{
"event": "setBackgroundImgData",
"path": "Device path",
"payload": {
"imgData": "Base64 encoded image data"
}
}
Parameter Description:
event: Fixed as "setBackgroundImgData"path: Unique device identifierpayload.imgData: Base64 encoded RGB format image data
Important Notes:
- Do not send other commands while setting background image
- Need to send
readcommand first to receive notification of successful background setting
Example:
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
canvas.width = 800
canvas.height = 480
ctx.fillStyle = "pink";
ctx.fillRect(0, 0, 800, 480);
ctx.font = `${100}px'YaHei'`;
ctx.fillStyle = "white";
ctx.fillText("TEST", 150, 100);
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const byteArray = imageData.data; // Get byte array
// Convert RGBA to RGB (SDK uses RGB channels)
const rgbByteArray = [];
for (let i = 0; i < byteArray.length; i += 4) {
rgbByteArray.push(byteArray[i+2], byteArray[i+1], byteArray[i]);
}
// Convert RGB byte array to Base64
function byteArrayToBase64(byteArray) {
let binary = '';
for (let i = 0; i < byteArray.length; i++) {
binary += String.fromCharCode(byteArray[i]);
}
return btoa(binary); // Convert binary string to Base64
}
const base64String = byteArrayToBase64(rgbByteArray);
const data = {
"event": "setBackgroundImgData",
"path": path,
"payload": {
"imgData": base64String,
}
};
ws.send(JSON.stringify(data));
clearAllIcon
Clear all key icons on the device. It's recommended to execute this operation before setting new icons.
{
"event": "clearAllIcon",
"path": "Device path"
}
Parameter Description:
event: Fixed as "clearAllIcon"path: Unique device identifier
clearIcon
Clear the icon of a specified key.
{
"event": "clearIcon",
"path": "Device path",
"payload": {
"keyIndex": 1
}
}
Parameter Description:
event: Fixed as "clearIcon"path: Unique device identifierpayload.keyIndex: Key number to clear (starts from 1)
setKeyImg
Set the icon for a specified key. Please note that different devices support different icon sizes.
{
"event": "setKeyImg",
"path": "Device path",
"payload": {
"imagePath": "Icon file path",
"keyIndex": 1
}
}
Parameter Description:
event: Fixed as "setKeyImg"path: Unique device identifierpayload.imagePath: Path of the icon filepayload.keyIndex: Key number (starts from 1)
Usage Tips:
- Refer to the device specification table above for supported icon sizes for different devices
setKeyImgData
Set the icon for a specified key via image data, suitable for scenarios with dynamically generated icons.
{
"event": "setKeyImgData",
"path": "Device path",
"payload": {
"imgData": "Base64 encoded image data",
"keyIndex": 1
}
}
Parameter Description:
event: Fixed as "setKeyImgData"path: Unique device identifierpayload.imgData: Base64 encoded RGB format image datapayload.keyIndex: Key number (starts from 1)
Important Notes:
- Refer to the device specification table above for supported icon sizes for different devices
setBrightness
Adjust device screen brightness.
{
"event": "setBrightness",
"path": "Device path",
"payload": {
"brightness": 80
}
}
Parameter Description:
event: Fixed as "setBrightness"path: Unique device identifierpayload.brightness: Brightness value (0-100, 0 is darkest, 100 is brightest)
refresh
Refresh device display to make set icons or background take effect immediately.
{
"event": "refresh",
"path": "Device path"
}
Parameter Description:
event: Fixed as "refresh"path: Unique device identifier
setLEDBrightness
Set LED brightness.
{
"event": "setLEDBrightness",
"path": "Device path",
"payload": {
"brightness": 80
}
}
Parameter Description:
event: Fixed as "setLEDBrightness"path: Unique device identifierpayload.brightness: Brightness value (0-100)
setLEDColor
Set LED color.
{
"event": "setLEDColor",
"path": "Device path",
"payload": {
"r": 255,
"g": 0,
"b": 0
}
}
Parameter Description:
event: Fixed as "setLEDColor"path: Unique device identifierpayload.r: Red component (0-255)payload.g: Green component (0-255)payload.b: Blue component (0-255)
resetLEDColor
Reset LED color.
{
"event": "resetLEDColor",
"path": "Device path"
}
Parameter Description:
event: Fixed as "resetLEDColor"path: Unique device identifier
setKeyboardLightingEffects
Set keyboard lighting effects.
{
"event": "setKeyboardLightingEffects",
"path": "Device path",
"payload": {
"effect": 1
}
}
Parameter Description:
event: Fixed as "setKeyboardLightingEffects"path: Unique device identifierpayload.effect: Effect mode (0-9)
setKeyboardLightingSpeed
Set keyboard lighting speed.
{
"event": "setKeyboardLightingSpeed",
"path": "Device path",
"payload": {
"speed": 5
}
}
Parameter Description:
event: Fixed as "setKeyboardLightingSpeed"path: Unique device identifierpayload.speed: Speed value (0-7)
setKeyboardRGBBacklight
Set keyboard RGB backlight.
{
"event": "setKeyboardRGBBacklight",
"path": "Device path",
"payload": {
"r": 255,
"g": 0,
"b": 0
}
}
Parameter Description:
event: Fixed as "setKeyboardRGBBacklight"path: Unique device identifierpayload.r: Red component (0-255)payload.g: Green component (0-255)payload.b: Blue component (0-255)
setKeyboardOSMode
Set keyboard OS mode.
{
"event": "setKeyboardOSMode",
"path": "Device path",
"payload": {
"osMode": 0
}
}
Parameter Description:
event: Fixed as "setKeyboardOSMode"path: Unique device identifierpayload.osMode: 0: Windows, 1: macOS
setKeyboardBacklightBrightness
Set keyboard backlight brightness.
{
"event": "setKeyboardBacklightBrightness",
"path": "Device path",
"payload": {
"brightness": 6
}
}
Parameter Description:
event: Fixed as "setKeyboardBacklightBrightness"path: Unique device identifierpayload.brightness: Brightness value (0-6)
Usage Scenarios:
- Uniform refresh after setting icons in batch
- Ensure all changes have been displayed
