Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function (nodecg) {
const currentScene = nodecg.Replicant('currentScene', {defaultValue: ''});
// Start with a stub that we'll replace if we have all the config we need.
module.exports.resetCropping = function () {};
if (!nodecg.bundleConfig.obsWebsocket.address) {
nodecg.log.error('"obsWebsocket" is not defined in cfg/agdq17-layouts.json! ' +
'OBS Studio integration will be disabled.');
return;
}
const ws = new OBSWebSocket();
let notifiedConnectionFailed = false;
ws.onConnectionOpened = function () {
notifiedConnectionFailed = false;
nodecg.log.info('[obs-websocket] Connected.');
};
ws.onAuthenticationSuccess = function () {
nodecg.log.info('[obs-websocket] Authenticated.');
getCurrentScene();
};
ws.onConnectionClosed = function () {
nodecg.log.warn('[obs-websocket] Connection closed, attempting to reconnect in 5 seconds.');
setTimeout(connectToOBS, 5000);
};
module.exports = function (nodecg) {
const currentScene = nodecg.Replicant('currentScene', {defaultValue: ''});
// Start with a stub that we'll replace if we have all the config we need.
module.exports.resetCropping = function () {};
if (!nodecg.bundleConfig.obsWebsocket.address) {
nodecg.log.error('"obsWebsocket" is not defined in cfg/sgdq17-layouts.json! ' +
'OBS Studio integration will be disabled.');
return;
}
const ws = new OBSWebSocket();
let notifiedConnectionFailed = false;
ws.onConnectionOpened = function () {
notifiedConnectionFailed = false;
nodecg.log.info('[obs-websocket] Connected.');
};
ws.onAuthenticationSuccess = function () {
nodecg.log.info('[obs-websocket] Authenticated.');
getCurrentScene();
};
ws.onConnectionClosed = function () {
nodecg.log.warn('[obs-websocket] Connection closed, attempting to reconnect in 5 seconds.');
setTimeout(connectToOBS, 5000);
};