-
Notifications
You must be signed in to change notification settings - Fork 32
UDP Plugin
Andreas Dzialocha edited this page Jan 12, 2017
·
5 revisions
A default Datagram (UDP) instance listening on localhost:41234 and sending to localhost:41235
const osc = new OSC({ plugin: new OSC.DatagramPlugin() })
osc.open() // bind udp socket to port 41234The options can be passed on inside the constructor. The open or send message can also take individual options. This will then override the globally set options for their regarding methods.
{
type: 'udp4', // @param {string} 'udp4' or 'udp6'
open: {
host: 'localhost', // @param {string} Hostname of udp server to bind to
port: 41234, // @param {number} Port of udp server to bind to
exclusive: false // @param {boolean} Exclusive flag
},
send: {
host: 'localhost', // @param {string} Hostname of udp client for messaging
port: 41235 // @param {number} Port of udp client for messaging
}
}const options = {
open: {
port: 9912
}
}
const osc = new OSC({ plugin: new OSC.DatagramPlugin(options) })
osc.open()const osc = new OSC({ plugin: new OSC.DatagramPlugin() })
osc.open({ port: 9912 })const osc = new OSC({ plugin: new OSC.DatagramPlugin() })
osc.open({ port: 9912 })
// send only this message to `localhost:9002`
osc.send(new OSC.Message('/test'), { port: 9002 })- Example: How to create an OSC UDP server with osc-js.
-
Documentation: Read about the
DatagramPluginclass here.
osc-js | Overview | Basic Usage | Documentation
Getting started
Plugins
Customize
Examples