# OSCsend only transmits over UDP?

**URL:** <https://forum.csound.com/t/oscsend-only-transmits-over-udp/825>\
**Category:** General\
**Created:** [August 22, 2022, 10:07pm UTC](https://forum.csound.com/t/oscsend-only-transmits-over-udp/825 "2022-08-22T22:07:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JasonHallen](https://forum.csound.com/user_avatar/forum.csound.com/jasonhallen/32/32_2.png) [@JasonHallen](https://forum.csound.com/u/JasonHallen)\
**Post date:** [August 22, 2022, 10:07pm UTC](https://forum.csound.com/t/oscsend-only-transmits-over-udp/825/1 "2022-08-22T22:07:56Z")

</div>

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](https://www.npmjs.com/package/osc-js). I’m able to receive the OSC messages very well when I’m running a UDP server with ocs-js like this:

```csound
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.

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

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

```

Thanks!  
Jason

---

<div class="post-metadata">

**Author:** ![JasonHallen](https://forum.csound.com/user_avatar/forum.csound.com/jasonhallen/32/32_2.png) [@JasonHallen](https://forum.csound.com/u/JasonHallen)\
**Post date:** [August 23, 2022, 4:26am UTC](https://forum.csound.com/t/oscsend-only-transmits-over-udp/825/2 "2022-08-23T04:26:32Z")

</div>

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](https://github.com/adzialocha/osc-js/wiki/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.

```csound
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](https://www.npmjs.com/package/csound-api) package.

Thanks,  
Jason
