Wow, odd that data is missing. It's not usually an issue as Espruino WiFi can receive quite big things (like images) over HTTP without issues.
If you run E.getErrorFlags() does it say anything?
FIFO_FULL would indicate that data has come in faster than Espruino could handle and it had to drop something, so that would be the first port of call.
You could also try adding the turbo mode (wifi.turbo(true,callback) as part of your wifi initialising code) - that'll hugely increase the baud rate from the ESP8266, which might help if the ESP8266 itself had been losing data (it shouldn't though);
Please could you also post up the complete code you're using to read data into the buffer? I'm not sure I'm seeing your tcpOnMessage that does that?
And yeah, it looks to me like the out of memory when dumping is because dumpArray is just turning the array into one big string. If you could make dumpArray call console.log itself with each line of text as it was ready, that would probably help you out a bunch - but if you're not getting the amount of data you expect then it's not worth caring about yet.
I'm not sure I can help much more unless I can reproduce it, so if you don't have any luck with the above, maybe you could:
E.getErrorFlags() returned nothing. My stripped-down version of the code merely prints the number of bytes in each tcp on 'data' call. That version is calling dumpArray, isn't copying data, is only printing the count of data in each on 'data' call.
wifi.turbo() didn't help with respect to lost data, but boy the data arrived wicked-fast! I'm keeping that one.
I'm working on making a node version, stripped down, which is what I'll post when done.
© Espruino, powered by microcosm.
Report a problem