I have a transform stream (something like the Incoming in https://github.com/isaacs/simple-protocol).
I now would like to keep the underlaying TCP socket alive for new Incoming streams.
I think wrapping the tcp socket into a Duplex stream which creates a new Incoming transform instance each time when the previous Incoming is full.
This sounds easy however I fail finding a solution to know when the transform stream has consumed enough data. Listening on the "end" event is not a reliable option as the last chunk could already contain data for the next Incoming message.
Anyone am idea?
Best,
Bo