Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

OBS Studio connection problem #289

Unanswered
snuth33 asked this question in Q&A
Jul 1, 2022 · 1 comments · 8 replies
Discussion options

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.2
  • vite@1.0.0-rc.13
  • vue@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:2828
  • Uncaught (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 !

You must be logged in to vote

Replies: 1 comment 8 replies

Comment options

My first guess would be check the port, in obs-websocket 5.0.0-beta1 the default port was changed to 4455

You must be logged in to vote
8 replies
Comment options

t2t2 Jul 1, 2022
Maintainer

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)
}
Comment options

The error message is:
image

Comment options

t2t2 Jul 2, 2022
Maintainer

Check the console with debug logs on:

localStorage.debug = '*'

(Then reload the page, and in dev tools make sure verbose logging is on)

image

Comment options

I need to put this line in my code ?

Comment options

t2t2 Jul 2, 2022
Maintainer

can just paste into the console and then refresh the page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /