Closed stuhowarth closed 2 years ago
obs-websocket - 4.9.1
Use v4(.0.3) of obs-websocket-js - documentation
So I have downgraded to the version mentioned and I am still getting an error:
As you can see it is now using Socket.js file.
Enable debug logging in obs-websocket settings and check what log (Help ->Log Files -> View Current Log) shows after connecting.
Also useful to check the websocket request in the network tab of the browser's dev tools (in chrome click on the request and check messages tab, in firefox click on the request and check response tab, firefox would also show a more detailed close reason)
Thank you for your help. I now have this working, it was because i was using the old async calls. I have changed my code to the following:
const OBSWebSocket = require('obs-websocket-js');
const obs = new OBSWebSocket();
obs.connect({ address: 'localhost:4444', password: 'password' }).then(() =>{
obs.sendCallback('GetSceneList', {}, (err, data) => {
console.log('Using callbacks:', err, data);
});
})
I can confirm this now opens the connection and I can see the scenes. Thank you.
Every time i run the obs.connect() function I am getting the following errors:
base.ts:110WebSocket connection to 'ws://127.0.0.1:4444/' failed: WebSocket is closed before the connection is established.
I also get the following error:
Failed to connect 1006
Which is being fired from my console log and its firing a 1006 error code.
Weirdly though when I load the page and these errors appear I see an OBS systray notification saying:
New WebSocket connection
Client: 127.0.0.1:64552 connected
And then a few seconds later I get another notification saying it has disconnected so clearly the JS is connecting to the websocket in some sort of capacity.
This is my code:
What could be going wrong? I have tried top rule out firewall issues by disabling my firewall to and it isn't that. Any help is greatly appreciated :)
System Versions:
OBS - 27.2.3
obs-websocket - 4.9.1
Node - 16.14.2
The OBS websocket appears in OBS and I have kept the port to 4444 and tried both with and without a password.