Skip to main content

OBS Integration

Overview

The OBS Integration module provides OBS WebSocket connectivity for remote control of OBS Studio from the Lumio dashboard. It supports scene switching, stream/recording start/stop, and connection status monitoring. OBS configuration (port, password, remote host) is stored in the integration_configs table with the password encrypted at rest. The module includes a connection testing feature that attempts a WebSocket handshake with a 10-second timeout.

Architecture

Backend

  • GraphQL (apps/api/src/graphql/obs.rs) -- Queries for OBS config, status, and remote connection status. Mutations for saving/deleting config, testing connection, and controlling stream/recording/scenes.
  • REST (apps/api/src/routes/obs_integration.rs) -- REST endpoints for OBS config CRUD, credential retrieval, status, and connection testing.
  • OBS Remote Client (crates/lo-obs-remote/) -- ObsRemoteClient handles WebSocket connections to OBS Studio, including authentication with the encrypted password.
  • Configuration Storage -- OBS config is stored as JSONB in the integration_configs table with platform = "obs". The password field is encrypted using AES-256.

Frontend

  • OBS settings page with port, password, and remote mode configuration.
  • Stream/recording control buttons.
  • Scene switcher with list of available scenes.
  • Connection status indicator.

API

GraphQL Queries

QueryPermissionDescription
obsConfigobs:readFull OBS config: port, remote_enabled, remote_host, has_password flag, timestamps. Never exposes the actual password.
obsStatusobs:readLightweight status: configured flag, port, remote settings
obsRemoteStatusobs:readRemote connection status from OBS worker: connected flag, stream/recording status, scene list, current scene. (Placeholder -- reads from WorkerManager/Redis in production.)

GraphQL Mutations

MutationPermissionDescription
saveObsConfig(port?, password?, remoteEnabled?, remoteHost?)obs:editSave (upsert) OBS config. Port defaults to 4455. Password is encrypted before storage.
deleteObsConfigobs:deleteDelete OBS integration config
testObsConnectionobs:editTest WebSocket connection to OBS. Only available when remote mode is enabled. 10-second timeout. Returns success/error.
obsControlStream(action)obs:editControl streaming: "start" or "stop"
obsControlRecording(action)obs:editControl recording: "start" or "stop"
obsSwitchScene(sceneName)obs:editSwitch the active OBS scene

REST Endpoints

MethodPathPermissionDescription
GET/v1/integrations/obsobs:readGet OBS config
PUT/v1/integrations/obsobs:editSave OBS config
DELETE/v1/integrations/obsobs:deleteDelete OBS config
GET/v1/integrations/obs/credentialsobs:readGet OBS credentials (decrypted, for internal use)
GET/v1/integrations/obs/statusobs:readGet OBS connection status
POST/v1/integrations/obs/testobs:editTest OBS WebSocket connection

Permissions

PermissionDescription
obs:readRead OBS configuration and status
obs:editEdit OBS configuration, test connection, control stream/recording/scenes
obs:deleteDelete OBS configuration

Database

TableDatabaseDescription
integration_configsPostgreSQLid, account_id, platform ("obs"), label ("OBS Studio"), enabled, config (JSONB), created_at, updated_at. Unique on (account_id, platform).

Config JSONB Structure

{
"port": 4455,
"password": "encrypted_string_or_null",
"remote_enabled": false,
"remote_host": "192.168.1.100"
}
  • port -- OBS WebSocket port (default 4455)
  • password -- Encrypted OBS WebSocket password (null if not set)
  • remote_enabled -- Whether remote (non-localhost) connections are enabled
  • remote_host -- Remote host address (only used when remote_enabled is true)

Data Flow

  1. User configures OBS settings (port, optional password, optional remote host).
  2. Password is encrypted via crypto::encrypt() and stored as part of the JSONB config.
  3. User can test the connection, which attempts a WebSocket handshake to ws://{host}:{port} with decrypted password.
  4. Stream/recording/scene commands are sent via the WorkerManager to the OBS Remote Client.
  5. OBS Remote Client communicates with OBS Studio over the OBS WebSocket protocol.

Plan Restriction

OBS remote mode (remote_enabled: true) is only available on the Pro plan and above (obs_remote_allowed in PlanLimits).

Key Files

PathDescription
apps/api/src/graphql/obs.rsGraphQL queries and mutations
apps/api/src/routes/obs_integration.rsREST endpoints
apps/api/src/routes/obs_remote.rsRemote control routes
crates/lo-obs-remote/OBS WebSocket client
apps/api/src/crypto.rsPassword encryption/decryption