Created
January 14, 2012 04:15
-
-
Save hideyukisaito/1610253 to your computer and use it in GitHub Desktop.
osc4node and express example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
, osc = require('osc4node') | |
, app = express.createServer() | |
, port = process.env.PORT || 3000; | |
app.configure(function() { | |
app.use(app.router); | |
}); | |
app.get('/', function(req, res) { | |
// send | |
server.send(message, client); | |
res.end('send data to localhost:' + client.port); | |
}); | |
// create osc server and client | |
var server = new osc.Server(11000, 'localhost') | |
, client = new osc.Client('localhost', 12000); | |
// create osc message | |
var message = new osc.Message('/foo/bar', 'hello world'); | |
app.listen(port); | |
console.log('listening OSC on port ' + server.port + '...'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment