l@271: # This example simply sends a message with several parameter types l@271: # every two seconds to port 41234 l@271: l@271: osc = require 'osc-min' l@271: dgram = require "dgram" l@271: l@271: udp = dgram.createSocket "udp4" l@271: l@271: if process.argv[2]? l@271: outport = parseInt process.argv[2] l@271: else l@271: outport = 41234 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: sendHeartbeat = () -> l@271: buf = osc.toBuffer( l@271: address : "/heartbeat" l@271: args : [ l@271: 12 l@271: "sttttring" l@271: new Buffer "beat" l@271: {type : "integer", value : 7} l@271: ] l@271: ) l@271: l@271: udp.send buf, 0, buf.length, outport, "localhost" l@271: l@271: setInterval sendHeartbeat, 2000