Skip to content

Instantly share code, notes, and snippets.

@colinbdclark
Created September 12, 2019 21:04
Show Gist options
  • Save colinbdclark/0b6366237688353ca0b84100b097c979 to your computer and use it in GitHub Desktop.
Save colinbdclark/0b6366237688353ca0b84100b097c979 to your computer and use it in GitHub Desktop.
Relay OSC message to multiple targets
var incomingUDPPort = new osc.UDPPort({...});
var outgoingUDPPortToSuperCollider = new osc.UDPPort({...});
wss.on("connection", function (socket) {
console.log("A Web Socket connection has been established!");
var socketPort = new osc.WebSocketPort({
socket: socket
});
// Whenever we get an incoming OSC message, forward it on to SuperCollider and the Web Socket.
incomingUDPPort.on("raw", function (packet) {
outgoingUDPPortToSuperCollider.sendRaw(packet);
socketPort.sendRaw(packet);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment