Node.js API
    Preparing search index...

    Class PluginSDK

    The PluginSDK provides the core functionality for building plugins that communicate with the Logi Plugin Service. It handles WebSocket communication, action registration, message dispatching, and connection management.

    import { PluginSDK } from '@logitech/plugin-sdk';
    import { MyCustomAction } from './actions/my-custom-action';

    const sdk = new PluginSDK();

    // Register your custom actions
    const myAction = new MyCustomAction();
    sdk.registerAction(myAction);

    // Connect to the Logi Plugin Service
    await sdk.connect();
    Index

    Constructors

    Methods

    Constructors

    • Creates a new PluginSDK instance with the specified configuration options.

      Initializes the WebSocket client for communication with the Logi Plugin Service, sets up the message dispatcher for handling incoming messages, configures the logger with the specified log level, and establishes connection event handlers.

      Parameters

      • options: PluginSDKOptions = ...

        Configuration options for the SDK. If not provided, defaults to WARN log level.

      Returns PluginSDK

      import { PluginSDK, LoggerLevel } from '@logitech/plugin-sdk';

      // Create SDK with default options (WARN log level)
      const sdk = new PluginSDK();

      // Create SDK with custom log level
      const debugSdk = new PluginSDK({ logLevel: LoggerLevel.DEBUG });

      // Create SDK with minimal logging
      const quietSdk = new PluginSDK({ logLevel: LoggerLevel.ERROR });

    Methods

    • Establishes connection to the Logi Plugin Service.

      This method connects the plugin to the Logi Plugin Service via WebSocket, enables communication, and sets up graceful shutdown handling. Must be called after registering all actions.

      Returns Promise<void>

      Promise that resolves when connection is established

      Will log errors if connection fails

      const sdk = new PluginSDK();

      // Register actions first
      sdk.registerAction(new MyAction());

      // Then connect
      try {
      await sdk.connect();
      console.log('Plugin connected successfully');
      } catch (error) {
      console.error('Failed to connect:', error);
      }
    • Registers an action with the plugin.

      Actions must be registered before connecting to the Logi Plugin Service to be available for assignment to controls.

      Parameters

      • action: Action

        The action instance to register

      Returns void

      import { CommandAction } from '@loupedeck/plugin-sdk';

      class MyAction extends CommandAction {
      readonly name = 'my-action';
      displayName = 'My Action';
      description = 'Does something useful';

      onKeyDown() {
      console.log('Action executed!');
      }
      }

      const myAction = new MyAction();
      sdk.registerAction(myAction);