I am writing a script that checks a devices gyroscope axis's with JavaScript. I need to send a front-end javascript variable, that is updated frequently, sometimes up to a couple times a second, to a back-end node.js variable. I heard that this is doable with express-ws
, but if that is not necessary, that would be better.
If it matters, my JS variables are formatted similar to:
x = -103
y = 50
z = -10
(x, y, z could be a negative or positive integer) Thanks!
Look into socket.send()
and socket.emit()
.