clientShake.write('hello') console.log('client: %s', awaitserverShake.read()) // > client: hello serverShake.write('hi') serverShake.rest() // the server has finished the handshake console.log('server: %s', awaitclientShake.read()) // > server: hi clientShake.rest() // the client has finished the handshake
// Make the server echo responses pipe( serverShake.stream, asyncfunction* (source) { forawait (constmessageofsource) { yieldmessage } }, serverShake.stream )
// Send and receive an echo through the handshake stream pipe( ['echo'], clientShake.stream, asyncfunction* (source) { forawait (constbufferListofsource) { console.log('Echo response: %s', bufferList.slice()) // > Echo response: echo } } )
Example