OBS WebSocket connection issue with OBS Studio 29.0.2 and obs-websocket 4.9.1-compat #1120
Unanswered
CetoStream
asked this question in
Q&A
Replies: 1 comment
-
` <script>
` |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am having an issue with connecting my Node.js project to OBS Studio using the obs-websocket-js library. I am using OBS Studio 29.0.2 and the obs-websocket 4.9.1-compat plugin.
Here is the code I'm using to connect:
`const OBSWebSocket = require('obs-websocket-js');
const obs = new OBSWebSocket();
obs.connect({
address: 'localhost:4444', // Replace with your obs-websocket address and port if necessary
password: '' // Replace with your obs-websocket password if necessary
})
.then(() => {
console.log('Connected to OBS WebSocket');
})
.catch(err => {
console.error('Error connecting to OBS WebSocket:', err);
});
// Example of listening to an event
obs.on('SwitchScenes', data => {
console.log(
New active scene: ${data.sceneName}
);});
// Error handler to avoid uncaught exceptions
obs.on('error', err => {
console.error('Socket error:', err);
});`
When I run the code, I get the following error:
Error connecting to OBS WebSocket: SyntaxError: Invalid URL: [object Object]
I have double-checked my obs-websocket settings in OBS Studio, and they seem to be correct. I also tried to check if my firewall or antivirus software is blocking the connection between my Node.js project and obs-websocket, but it does not seem to be the case.
Is there any known issue with this version of OBS Studio and obs-websocket? Or is there something I'm missing in my code?
Any help would be greatly appreciated. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions