Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBS update to obs-websocket version 5.4.2 preventing connection to obs-websocket-js version 5.0.5 #354

Open
V-u-b-a-r opened this issue Apr 18, 2024 · 1 comment

Comments

@V-u-b-a-r
Copy link

V-u-b-a-r commented Apr 18, 2024

Description:

OBS updated it's websocket settings, which is now preventing me from connecting to the websocket at all. Release notes are:

Updated obs-websocket to version 5.4.2 [tt2468/Lain-B]
Release notes for addition in 5.4.0 are here: https://github.com/obsproject/obs-websocket/releases/tag/5.4.0

And release notes:

base: Update version to 5.4.0
@tt2468 tt2468 tagged this Jan 25
New Features:

  • Added GetSourceFilterKindList request
  • Added GetSceneItemSource request
  • Added InputSettingsChanged event
  • Added SourceFilterSettingsChanged event
  • Added UUID support to Sources (Inputs/Scenes), Inputs, Scenes,
    Transitions
    • The Source requests/events use sourceUuid
    • The Input requests/events use inputUuid
    • The Scene requests/events use sceneUuid
    • The Transition requests/events use transitionUuid
    • Filters do not have support for UUIDs at this time.

Enhancements:

  • Added contextName field to TriggerHotkeyByName (exeldro)

Bug Fixes:

  • Fixed a crash on shutdown with notifications enabled (r1ch)
  • Added safety check to prevent null outputCongestion values in
    GetStreamStatus
  • Fixed a memory leak when switching service kinds via
    SetStreamServiceSettings

Other Notes:

  • Documented missing outputActive ToggleRecord response field
  • Added a few new client softwares to the README list
  • Removed a mis-documented imageData field
  • Added a note to the hotkey requests that they are as-is and we
    will not provide support for them

Versions Used (if applicable):

  • obs-websocket-js version: obs-websocket-js@5.0.5
  • obs-websocket plugin version: Updated obs-websocket to version 5.4.2 [tt2468/Lain-B]
  • obs-studio version: 30.1.2 (64 bit)
  • node version: v16.14.0

Code sample:

My connection code, which connected before the OBS update and does not now (note it does not throw an error either):

async function connectToObs() {
  try {
    const { obsWebSocketVersion, negotiatedRpcVersion } = await obs.connect(
      'ws://localhost:4455', 
      { rpcVersion: 1 }
    );

    console.log(`Connected to OBS WebSocket v${obsWebSocketVersion} using RPC version ${negotiatedRpcVersion}`);
    reconnectAttempts = 0;

    obs.on('ConnectionClosed', () => {
        console.log('OBS connection closed. Attempting to reconnect...');
        attemptObsReconnect();
    });
    
    obs.on('ConnectionError', (error) => {
        console.error('OBS connection error:', error);
        attemptObsReconnect();
    });
    
    process.on('SIGINT', async () => {
        console.log('Process terminated. Closing OBS WebSocket connection...');
        try {
            disconnectObs();
        } catch (error) {
            console.error('Error closing OBS WebSocket connection:', error);
        }
        process.exit(0); // Optional: Forcefully terminate process after disconnection
    });
    
    process.on('SIGTERM', async () => {
        console.log('Process terminated. Closing OBS WebSocket connection...');
        try {
            disconnectObs();
        } catch (error) {
            console.error('Error closing OBS WebSocket connection:', error);
        }
        process.exit(0); // Optional: Forcefully terminate process after disconnection
    });
  } catch (error) {
    console.error('Failed to connect:', error);
    attemptObsReconnect();
  }
}
@V-u-b-a-r
Copy link
Author

Update: It now appears to be working again... Maybe there was something out of sync after the OBS update, that has corrected itself now... but I'll monitor this for a few more streams and then close if it's stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant