英文:
obs-websocket-js failed to connect. Server sent no subprotocol
问题
我想使用obs-websocket-js包来构建一个通过websocket连接到OBS Studio的应用程序。
当我尝试运行连接函数时,我遇到了Failed to connect -1 Server sent no subprotocol
错误。
OBS Studio正在运行于我系统上的Oracle VM VirtualBox上的Ubuntu 20.01上。
Node.JS代码:
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));
我希望能够成功连接并找出为什么会出现"Server sent no subprotocol"错误。
英文:
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.
答案1
得分: 1
我找到了一个非常简单的解决方案:我将OBS Studio更新到最新的29.0.0版本,然后它就可以正常工作了。
英文:
I found a very simple solution: I updated the OBS Studio to the latest 29.0.0 version and it worked.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论