l@271: // Generated by CoffeeScript 1.10.0 l@271: var dgram, 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: console.log("sending heartbeat messages to http://localhost:" + outport); l@271: l@271: //~verbatim:examples[1]~ l@271: //### Send a bunch of args every two seconds; l@271: l@271: sendHeartbeat = function() { l@271: var buf; l@271: buf = osc.toBuffer({ l@271: address: "/heartbeat", l@271: args: [ l@271: 12, "sttttring", new Buffer("beat"), { l@271: type: "integer", l@271: value: 7 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);