obs-websocket-community-projects / obs-websocket-js

Consumes https://github.com/obsproject/obs-websocket
MIT License
680 stars 96 forks source link

Server sent no subprotocol #275

Closed brian-gates closed 2 years ago

brian-gates commented 2 years ago

Description:

When attempting to connect with the following code and configuration, I get the error: Server sent no subprotocol

Code

  const obs = new OBSWebSocket();
  obs
    .connect("ws://127.0.0.1:4440", undefined, {
      eventSubscriptions:
        EventSubscription.All | EventSubscription.InputVolumeMeters,
    })
    .then(() => {
      debugger;
    })
    .catch((error) => {
      debugger;
    });

Error Stack

Error: Server sent no subprotocol
    at OBSWebSocket.onError (e:\SteamLibrary\steamapps\common\OVR Toolkit\LocalCustomApps\Automation Assistant\node_modules\obs-websocket-js\dist\json.cjs:841:17)
    at WebSocket.onError (e:\SteamLibrary\steamapps\common\OVR Toolkit\LocalCustomApps\Automation Assistant\node_modules\ws\lib\event-target.js:220:18)
    at WebSocket.emit (node:events:390:28)
    at WebSocket.emit (node:domain:475:12)
    at Object.onceWrapper (node:events:510:26)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

obs-websocket

Config

obs-websocket-config

Debug Alerts

image

Versions Used:

t2t2 commented 2 years ago

obs-websocket-js 5.x.x is only designed to support obs-websocket plugin versions of 5.x.x due to major differences in authentication and message structure.

obs-websocket plugin v4.9.1-compat is just 4.9.1 but changed plugin id so 4.9.1 and 5.x can be ran side-by-side, so to connect v4.x of obs-websocket-js is required (documentation)