From 51f694b764f3e27712ad76a782babe5e03dd0091 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 21 Jul 2017 16:28:34 +0200 Subject: [PATCH] osc: add support for special target "self", broadcast osc to other clients after sending the messages --- app/examples/demo.js | 6 +++--- app/main/callbacks.js | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/examples/demo.js b/app/examples/demo.js index 004d131f..cf4f05d0 100644 --- a/app/examples/demo.js +++ b/app/examples/demo.js @@ -615,9 +615,9 @@ "root" ], "target": [ - "127.0.0.1:8080" + "self" ], - "value": "", + "value": "{ \"color\": \"auto\" }", "values": { "Default": "{ \"color\": \"auto\" }", "Orange": "{ \"color\": \"orange\" }" @@ -684,7 +684,7 @@ "scroll": true } ], - "color": "orange", + "color": "auto", "css": "", "value": "", "precision": 0, diff --git a/app/main/callbacks.js b/app/main/callbacks.js index 278ec205..4ea3fca0 100644 --- a/app/main/callbacks.js +++ b/app/main/callbacks.js @@ -185,7 +185,6 @@ module.exports = { } } - clients[clientId].broadcast.emit('receiveOsc', data) var targets = [] @@ -195,6 +194,11 @@ module.exports = { for (var i in targets) { + if (targets[i] == 'self') { + ipc.send('receiveOsc',data,clientId) + continue + } + var host = targets[i].split(':')[0], port = targets[i].split(':')[1] @@ -216,6 +220,9 @@ module.exports = { } } + + clients[clientId].broadcast.emit('receiveOsc', data) + }, addWidget(data, clientId) {