diff --git a/libs/message.js b/libs/message.js index 6a13e972048..28b13f9448b 100644 --- a/libs/message.js +++ b/libs/message.js @@ -101,7 +101,8 @@ class Message { let msg = global.commons.prepare('filters.setVariable', { value: attr.param, variable: variable }) global.commons.sendMessage(msg, { username: attr.sender, quiet: _.get(attr, 'quiet', false) }) - global.widgets.custom_variables.io.emit('refresh') // send update to widget + if (require('cluster').isWorker) process.send({ type: 'widget_custom_variables', emit: 'refresh' }) + else global.widgets.custom_variables.io.emit('refresh') // send update to widget global.twitch.setTitleAndGame(global.twitch, null) // update title return '' diff --git a/libs/widgets/custom_variables.js b/libs/widgets/custom_variables.js index 60ec2b334ca..0082d73aed6 100644 --- a/libs/widgets/custom_variables.js +++ b/libs/widgets/custom_variables.js @@ -7,6 +7,11 @@ class CustomVariablesWidget { constructor () { global.panel.addWidget('customvariables', 'widget-title-customvariables', 'fas fa-dollar-sign') this.sockets() + + require('cluster').on('message', (worker, message) => { + if (message.type !== 'widget_custom_variables') return + this.io.emit(message.emit) // send update to widget + }) } sockets () {