Open Twipped opened 9 years ago
you shouldn't actually call write directly though, it's better to pipe from a source stream (this module is used by thousands of people and is years old and no one has complained about this before)
JSONStream doesn't do anything async (io) so there isn't really any benefit to providing a callback. it would just callback right away anyway
Im piping it into a socket. I want confirmation that the socket sent the message. I was under the impression thats what the callback is for.
On Oct 9, 2015, at 5:18 PM, Dominic Tarr notifications@github.com wrote:
you shouldn't actually call write directly though, it's better to pipe from a source stream (this module is used by thousands of people and is years old and no one has complained about this before)
JSONStream doesn't do anything async (io) so there isn't really any benefit to providing a callback. it would just callback right away anyway
— Reply to this email directly or view it on GitHub.
It will tell you whether node flushed that to the kernel, but that doesn't mean that the recipient actually received it. the tcp stream could be interrupted after you send it, but before it is received. If you really want a reliable transmission, you need to query the recipient for the latest row received at the start of the session.
According to the node docs, Writable.write() should take an optional callback for when the data has been written to the stream. This callback never gets invoked on JSONStream.
Output: