...I guess it is a left over, because it is sent after this draining loop completed and end has already been issued. I read this out of walking through the code: line 47 writes the closing and end after all sub objects have been written.
No, it is sent before the draining loop fires even though the code comes afterwards. The 'drain' event will only fire once the socket 'drains', which will happen once the { gets written.
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.
...I guess it is a left over, because it is sent after this draining loop completed and end has already been issued. I read this out of walking through the code: line 47 writes the closing and end after all sub objects have been written.