CreatorCreator
Home
Getting Started
  • 中文简体
  • English
Home
Getting Started
  • 中文简体
  • English
  • Creator

    • Getting Started
  • Stream Dock

    • Plugin SDK
    • Icon Pack

      • Overview
      • Terminology
      • Creating an Icon Pack
      • Icon Specifications
    • Scene Configuration

      • What is a Scenario Configuration?
      • Exporting
      • Use Cases
  • mPanel

    • Plugin SDK
  • Cpp SDK

    • Overview
    • Dependency Installation
    • Device Manager
    • StreamDock Base Class
    • Communication Transport
    • Example
    • API Reference
    • Source Code
  • Python SDK

    • Overview
    • Dependency Installation
    • Device Manager
    • StreamDock Base Class
    • API Reference
    • Examples
    • Source Code
  • Windows-WebSocket SDK

    • Overview
    • Getting Started
    • Events Sent
    • Events Received
    • Source Code
  • Support

    • Help and Bug Reporting

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 ModelScreen SizeKey SizeSpecial Description
StreamDock 293800×480100×10015 keys
StreamDock 293V3800×480112×11215 keys
StreamDock 293s800×480100×10015 keys
StreamDock N3320×24064×646 keys
StreamDock N4800×480112×112 (keys) / 176×112 (secondary screen)15 keys + 4 knobs
StreamDock N1480×85496×9617 keys+1 knob
StreamDock M3854×48096×96 (keys) / 176×96 (secondary screen)15 keys + 4 knobs
StreamDock M18480×27264×6418 keys
StreamDock XL1024×60080×8032 keys + 2 side toggle switches
K1Pro800×480112×1126 keys + 3 knobs

Available Commands

CommandFunction Description
getFirmVersionGet device firmware version
readStart listening to device events (keys, knobs, etc.)
setBackgroundImgSet device background image
setBackgroundImgDataSet background image via data
clearAllIconClear all key icons
clearIconClear specified key icon
setKeyImgSet key icon
setKeyImgDataSet key icon via data
setBrightnessAdjust device brightness
refreshRefresh device display
setLEDBrightnessSet LED brightness
setLEDColorSet LED color
resetLEDColorReset LED color
setKeyboardLightingEffectsSet keyboard lighting effects
setKeyboardLightingSpeedSet keyboard lighting speed
setKeyboardRGBBacklightSet keyboard RGB backlight
setKeyboardOSModeSet keyboard OS mode (Win/Mac)
setKeyboardBacklightBrightnessSet 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 identifier
  • payload.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 read command 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 identifier
  • payload.imgData: Base64 encoded RGB format image data

Important Notes:

  • Do not send other commands while setting background image
  • Need to send read command 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 identifier
  • payload.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 identifier
  • payload.imagePath: Path of the icon file
  • payload.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 identifier
  • payload.imgData: Base64 encoded RGB format image data
  • payload.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 identifier
  • payload.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 identifier
  • payload.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 identifier
  • payload.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 identifier
  • payload.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 identifier
  • payload.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 identifier
  • payload.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 identifier
  • payload.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 identifier
  • payload.brightness: Brightness value (0-6)

Usage Scenarios:

  • Uniform refresh after setting icons in batch
  • Ensure all changes have been displayed
Last Updated:
Contributors: JKWTCN
Prev
Getting Started
Next
Events Received