Examples about receiving OSC data through WebSocket.
Sometimes I meet situations where I need OSC but cannot use UDP.
Such as sending OSC message from browser-based p5js to Processing / MaxMSP / Unity.
And my OSC controller called BugOSC, a WeChat Mini Program
, which also does not support UDP.
WeChat Mini Program has supported UDP at May 2019.
However, although they don't support UDP, they support WebSocket, another network transmission protocol.
Here are examples about receiving OSC data through WebSocket sent from p5js for example.
The transporting data are binary packets (ArrayBuffer, byte[]) following the standard OSC format.
The p5js sketch in p5js-client.
Use library osc.js to pack and parse OSC data.
And osc.js itself supports UDP (NodeJS), Serial port, WebSocket (browser and NodeJS) and TCP, Wow!
Click the first level links for detail README.
- Max
- Use
Node for Max
of Max 8 and osc.js.
- Use
- Processing
- WebSocket lib is Websockets for Processing which I forked to fix a bug about byte support.
- OSC lib is oscP5
- Unity
- WebSocket lib is websocket-sharp
- OSC packet parser is VVVVUnityOSC
- VVVV (Readme only)
- Pure Data (Readme only)
Of course also can make a third party NodeJS/Processing/Python/etc BRIDGE focus on receiving data through WebSocket and forwarding to other OSC receivers:
p5js-client <---WebSocket---> BRIDGE <---OSC---> Max/Processing/Unity/Arduino/etc
Welcome PR! 👏
Cheers~
Contra
- patreon (buy me a coffee XD): avantcontra
- website: avantcontra.com
- instagram: avantcontra
- twitter: avantcontra
- 微信公众号/知乎/抖音/小红书/B站:实验编程