Yes, I'd just send as binary. I think most likely it's the masking/unmasking that happens for Websockets. That's done in JS with a repeated append at the moment, which is probably the reason for the slowness - but having to parse the JSON each time won't help either.
The masking could reasonably easily be rewritten using E.mapInPlace, a Uint32Array and finally E.toString - there was a forum post about this somewhere a while back but I think there was a similar result - the user just decided to use TCPIP instead - which is almost certainly the right answer if you control both ends of the system :)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, I'd just send as binary. I think most likely it's the masking/unmasking that happens for Websockets. That's done in JS with a repeated append at the moment, which is probably the reason for the slowness - but having to parse the JSON each time won't help either.
The masking could reasonably easily be rewritten using
E.mapInPlace
, a Uint32Array and finallyE.toString
- there was a forum post about this somewhere a while back but I think there was a similar result - the user just decided to use TCPIP instead - which is almost certainly the right answer if you control both ends of the system :)