Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
//// Set up OSC connection from app.
this.transports.oscFromApp = new osc.Server(this.get('oscFromAppPort'));
// handle straight messages
this.transports.oscFromApp.on('message', _.bind(function(message, info) {
// handle bundles
if (message[0] == '#bundle')
this._handleOsc(this.transports.oscFromApp, message[2], info);
else
this._handleOsc(this.transports.oscFromApp, message, info);
}, this));
//// Set up OSC connection to app.
this.transports.oscToApp = new osc.Client('127.0.0.1', this.get('oscToAppPort'));
//// Set up socket connection to app.
this.transports.socketToApp = ioServer.listen(this.get('socketToAppPort'));
},
function client_channel_handler(socket) {
var ns = socket.namespace.name,
port = parse_io_ns_option(ns),
osc_client = new osc.Client('127.0.0.1', port);
// proxy osc messages from udp to socket.io
// expects 'message' in form of [path, value]
// ie. ['/osc/test', 200]
socket.on('message', function(message) {
osc_client.send(message[0], message[1]);
});
// expose a method to modify the client host. see readme.
// at the moment, this just creates a whole new
// client rather than configuring the host
// of the existing client.
socket.on('set-host', function(host) {
osc_client = new osc.Client(host, port);
});
}
var osc = require('node-osc');
var client = new osc.Client('127.0.0.1', 3333);
client.send('/oscAddress', 1, 1, 2, 3, 5, 8);
// or
// var msg = new osc.Message('/address')
// msg.append("testing");
// msg.append("testing");
// msg.append(123);
// client.send(msg)
// or
// var msg = new osc.Message('/address', 1, 2, 3);
// client.send(msg);
'use strict';
/**
* Author: Aravinth Panchadcharam
* Email: me@aravinth.info
* Date: 17/06/15.
* Contributors:
*/
var osc = require('node-osc');
var client = new osc.Client('127.0.0.1', 5000);
var classLabel = 2;
var data = require('../../../../data/test/json/' + classLabel + '.js');
var i = 0;
setInterval(function () {
if ('RIGHT' in data.handData[i] && 'LEFT' in data.handData[i]) {
var left = data.handData[i].LEFT.map(Number);
var right = data.handData[i].RIGHT.map(Number);
var output = left.concat(right);
client.send('/Data', output, function () {
console.log(output)
SuperCollider.prototype._createClient = function(port, rr, host) {
console.log(port, rr, host)
return new osc.Client(port, rr, host, true)
}
* along with this program. If not, see .
*/
var static = require('node-static')
, http = require('http')
, osc = require('node-osc')
, fs = require('fs')
, socketio = require('socket.io');
var ip = '255.255.255.255';
if (process.argv[2]) {
ip = process.argv[2];
}
console.log(ip);
var oscClient1 = new osc.Client(ip, 60000);
var oscClient2 = new osc.Client('127.0.0.1', 60000);
oscClient2._sock.bind();
oscClient2._sock.setBroadcast(true);
var state = {};
function dump() {
var kvpairs = [];
for (var k in state) {
kvpairs.push(k + ":" + state[k]);
}
return kvpairs.join(" ");
}
function updateState(msg) {
this.setup = function () {
if (!this.port) { return }
if (this.socket) { this.socket.close() }
this.socket = new osc.Client(client.io.ip, this.port)
console.info('OSC', `Started socket at ${client.io.ip}:${this.port}`)
}
}
const updateClient = (index, ip, port) => clients.splice(index, 1, new osc.Client(ip, port))
constructor(host) {
Object.keys(host).forEach(key => this[key] = host[key]);
if (this.type === 'udp') {
this.client = udpClient;
}
else {
this.client = new osc.Client(this.ip, this.port);
}
}
socket.on('set-host', function(host) {
osc_client = new osc.Client(host, port);
});
}