Have you considered using Open Sound Control[0]? There is a nice JS package for it. I've put together a couple demo web apps using OSC as both client and server. Bonuses include that you get midi with it, it creates RESTful 2 way interfaces for your endpoints, can be shared over the internet (WebRTC), and it's universally easy to hook to other stuff! Also there is a FANTASTIC customizable interface app for iOS and Android called TouchOSC[1] that only costs $5. I use it for music and robotics.
[0] https://github.com/colinbdclark/osc.js/
[1] https://hexler.net/software/touchosc
BONUS OSC STUFF:
* https://github.com/sebpiq/rhizome
* https://github.com/attwad/python-osc
* https://github.com/thomasfredericks/UnityOSC