Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit f3af3c6

Browse files
authored
Merge pull request #668 from codeoverflow-org/dependabot/npm_and_yarn/obs-websocket-js-5.0.0
chore(deps): bump obs-websocket-js from 4.0.3 to 5.0.0
2 parents 940a5ef + 3438907 commit f3af3c6

File tree

5 files changed

+96
-42
lines changed

5 files changed

+96
-42
lines changed

package-lock.json

Lines changed: 78 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/obs-scenelist/extension/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ module.exports = function (nodecg: NodeCG) {
88
const obs = requireService<OBSServiceClient>(nodecg, "obs");
99

1010
obs?.onAvailable((client) => {
11-
nodecg.log.info("OBS client has been updated, counting scenes and switching to another one.");
12-
client.send("GetSceneList").then((data) => {
11+
nodecg.log.info("OBS client has been updated, counting scenes and detecting when switching to another one.");
12+
client.call("GetSceneList").then((data) => {
1313
nodecg.log.info(`There are ${data.scenes.length} scenes!`);
1414
});
15-
client.on("SwitchScenes", (data) => {
16-
nodecg.log.info(`Scene changed to ${data["scene-name"]}.`);
15+
client.on("CurrentProgramSceneChanged", (data) => {
16+
nodecg.log.info(`Scene changed to ${data.sceneName}.`);
1717
});
1818
});
1919

services/nodecg-io-obs/extension/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import OBSWebSocket from "obs-websocket-js";
55
interface OBSServiceConfig {
66
host: string;
77
port: number;
8+
isSecure?: boolean;
89
password?: string;
910
}
1011

@@ -18,7 +19,7 @@ class OBSService extends ServiceBundle<OBSServiceConfig, OBSServiceClient> {
1819
async validateConfig(config: OBSServiceConfig): Promise<Result<void>> {
1920
const client = new OBSWebSocket();
2021
try {
21-
await client.connect({ address: `${config.host}:${config.port}`, password: config.password });
22+
await this.connectClient(client, config);
2223

2324
client.disconnect();
2425
} catch (e) {
@@ -30,7 +31,7 @@ class OBSService extends ServiceBundle<OBSServiceConfig, OBSServiceClient> {
3031
async createClient(config: OBSServiceConfig, logger: Logger): Promise<Result<OBSServiceClient>> {
3132
const client = new OBSWebSocket();
3233
try {
33-
await client.connect({ address: `${config.host}:${config.port}`, password: config.password });
34+
await this.connectClient(client, config);
3435
logger.info("Connected to OBS successfully.");
3536
} catch (e) {
3637
return error(e.error);
@@ -39,6 +40,11 @@ class OBSService extends ServiceBundle<OBSServiceConfig, OBSServiceClient> {
3940
return success(client);
4041
}
4142

43+
private async connectClient(client: OBSWebSocket, config: OBSServiceConfig): Promise<void> {
44+
const protocol = config.isSecure ? "wss" : "ws";
45+
await client.connect(`${protocol}://${config.host}:${config.port}`, config.password);
46+
}
47+
4248
stopClient(client: OBSServiceClient) {
4349
client.disconnect();
4450
}

services/nodecg-io-obs/obs-schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
"type": "string",
88
"description": "An IP address to the obs websocket server"
99
},
10+
"isSecure": {
11+
"type": "boolean",
12+
"description": "Whether the websocket connection is using encryption (wss) or not (ws)",
13+
"default": false
14+
},
1015
"port": {
1116
"type": "number",
1217
"description": "The port of the obs websocket server"

services/nodecg-io-obs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
},
3939
"dependencies": {
4040
"nodecg-io-core": "^0.3.0",
41-
"obs-websocket-js": "^4.0.3"
41+
"obs-websocket-js": "^5.0.0"
4242
}
4343
}

0 commit comments

Comments
 (0)