OSCsend only transmits over UDP?

Hi everyone,

Does the OSCsend opcode only transmit over UDP and not websockets?

Here’s my use case. In Csound I’m sending OSC messages like this:

OSCsend kcount, "127.0.0.1", 8080, "/test/message/", "f", kmeter

I’m listening for the message in Node.js with the “ocs-js” package. I’m able to receive the OSC messages very well when I’m running a UDP server with ocs-js like this:

const options = {
    type: 'udp4',
    open: {
      host: '127.0.0.1',
      port: 8080,
      exclusive: false
    },
    send: {
      host: '127.0.0.1',
      port: 8081
    }
  }
  const osc = new OSC({ plugin: new OSC.DatagramPlugin(options) })

However, when I listen with a websocket server like this I receive no messages from Csound. I’m able to listen to OSC messages sent from a browser using this same websocket server but not from Csound.

const options = {
    host: '127.0.0.1',
    port: 8080
  }

  const osc = new OSC({ plugin: new OSC.WebsocketServerPlugin(options) })

Thanks!
Jason

It seems like the answer is that OSCsend does indeed transmit over UDP. Fortunately, the osc-js package has a solution for connecting UDP and websocket servers called the “bridge plugin”.

My Node.js Express server is now able to receive OSC messages from Csound (via UDP) and from a browser window (via websocket) at the same time with the configuration below. At least I think that’s what’s happening… This is unfamiliar territory for me.

const config = {
  receiver: 'ws',         // @param {string} Where messages sent via 'send' method will be delivered to, 'ws' for Websocket clients, 'udp' for udp client
  udpServer: {
    host: 'localhost',    // @param {string} Hostname of udp server to bind to
    port: 9129,          // @param {number} Port of udp server to bind to
    exclusive: false      // @param {boolean} Exclusive flag
  },
  udpClient: {
    host: 'localhost',    // @param {string} Hostname of udp client for messaging
    port: 9130           // @param {number} Port of udp client for messaging
  },
  wsServer: {
    host: 'localhost',    // @param {string} Hostname of WebSocket server
    port: 8080            // @param {number} Port of WebSocket server
  }
}
const osc = new OSC({ plugin: new OSC.BridgePlugin(config) })

My end goal is to see whether this arrangement will be a good way to build HTML/CSS/JS-based GUIs along with Nate Whetsell’s csound-api package.

Thanks,
Jason