l@271: // Generated by CoffeeScript 1.10.0 l@271: var dgram, now, osc, outport, sendHeartbeat, udp; l@271: l@271: osc = require('osc-min'); l@271: l@271: dgram = require("dgram"); l@271: l@271: udp = dgram.createSocket("udp4"); l@271: l@271: if (process.argv[2] != null) { l@271: outport = parseInt(process.argv[2]); l@271: } else { l@271: outport = 41234; l@271: } l@271: l@271: now = function() { l@271: return (new Date()).getTime() / 1000; l@271: }; l@271: l@271: sendHeartbeat = function() { l@271: var buf; l@271: buf = osc.toBuffer({ l@271: timetag: now() + 0.05, l@271: elements: [ l@271: { l@271: address: "/p1", l@271: args: new Buffer("beat") l@271: }, { l@271: address: "/p2", l@271: args: "string" l@271: }, { l@271: timetag: now() + 1, l@271: elements: [ l@271: { l@271: address: "/p3", l@271: args: 12 l@271: } l@271: ] l@271: } l@271: ] l@271: }); l@271: return udp.send(buf, 0, buf.length, outport, "localhost"); l@271: }; l@271: l@271: setInterval(sendHeartbeat, 2000); l@271: l@271: console.log("sending heartbeat messages to http://localhost:" + outport);