-
Notifications
You must be signed in to change notification settings - Fork 99
-
Hi, I'm trying to connect to OBS Studio with obs-websocket-js but I can't. When I try, I get an OBS notification with a successful connection but after 2 seconds I get another notification for disconnection. I use :
obs-websocket-js@5.0.0-beta.2vite@1.0.0-rc.13vue@3.2.37- Chrome
When I open the console in Chrome, I have two messages:
WebSocket connection to 'ws://127.0.0.1:4444/' failed: createConnection @ obs-websocket-js.js:2828Uncaught (in promise) Error at OBSWebSocket.onClose (obs-websocket-js.js:3044:17)
My code (file main.js):
import OBSWebsocket from "obs-websocket-js";
const obs = new OBSWebsocket();
await obs.connect('ws://127.0.0.1:4444');
console.log('connected !!!');
Can you help me ?
Thank you !
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 8 replies
-
My first guess would be check the port, in obs-websocket 5.0.0-beta1 the default port was changed to 4455
Beta Was this translation helpful? Give feedback.
All reactions
-
Ok might be due to lack of password when connecting (there's a default randomly generated password since v5), add a catch around connect and see if it's in the error message:
import OBSWebsocket from "obs-websocket-js"; const obs = new OBSWebsocket(); try { await obs.connect('ws://127.0.0.1:4455'); console.log('connected !!!'); } catch (err) { console.error(err, err.message) }
Beta Was this translation helpful? Give feedback.
All reactions
-
The error message is:
image
Beta Was this translation helpful? Give feedback.
All reactions
-
Check the console with debug logs on:
localStorage.debug = '*'
(Then reload the page, and in dev tools make sure verbose logging is on)
Beta Was this translation helpful? Give feedback.
All reactions
-
I need to put this line in my code ?
Beta Was this translation helpful? Give feedback.
All reactions
-
can just paste into the console and then refresh the page
Beta Was this translation helpful? Give feedback.