I want to use obs-websocket-js package to build an app to connect to OBS Studio through websocket.
When I try running the connection function, I get a Failed to connect -1 Server sent no subprotocol
error.
The OBS Studio is running on Ubuntu 20.01 which is on a Oracle VM VirtualBox on my system.
Node.JS code:
const OBSWebSocket = require("obs-websocket-js").default;
const obs = new OBSWebSocket();
const connect = async () => {
try {
const { obsWebSocketVersion, negotiatedRpcVersion } = await obs.connect("ws://192.168.100.170:4444",undefined, {rpcVersion: 1});
return `Connected to server ${obsWebSocketVersion} (using RPC ${negotiatedRpcVersion})`;
} catch (error) {
console.error("Failed to connect", error.code, error.message);
}
};
connect().then((value) => console.log(value));
I expect to make a succesful connection and to find out why I have a Server sent no subprotocol error.
I found a very simple solution: I updated the OBS Studio to the latest 29.0.0 version and it worked.