Although if you need to route it to an external (non-browser) output, you might consider using OSC. There appear to be multiple implementations, but here's one: https://github.com/marmorkuchen-net/osc-js