easily create a duplex protocol that starts with a handshake
Make a duplex protocol that starts with a handshake.
Writing duplex protocols are difficult. (don't get me started on "callback hell", that is nothing) This module implements the boiler plate for a duplex protocol where a handshake is exchanged (and calculating the handshake can be async)
The basic outline for the sort of protocol you can build with pull-handshake is as follows:
handshake//callback with your metadatagetMyMetadatacb//compare my header with your header and decide what to send.var missing = findDifferenceme you//return a duplex pull-stream, that handles both reading and writing.returnsource: createReadStreammissingsink: createWriteStream
see pull-2step-replicate for a working example.