constmuxer = factory.createStreamMuxer(components, { onStream:stream=> { // Receive a duplex stream from the remote // ...receive data from the remote and optionally send data back }, onStreamEnd:stream=> { // ...handle any tracking you may need of stream closures } })
pipe(conn, muxer, conn) // conn is duplex connection to another peer
conststream = muxer.newStream() // Create a new duplex stream to the remote
// Use the duplex stream to send some data to the remote... pipe([1, 2, 3], stream)
This is a [simple stream multiplexer(https://docs.libp2p.io/concepts/multiplex/mplex/) that has been deprecated.
Please use @chainsafe/libp2p-yamux instead.
Example