Here are examples about defining protocols, it looks like your code is properly setting up the ipfs node to support stream multiplexing so you don't need to worry about trying to reuse an open connection - that should be handled for you https://github.com/libp2p/js-libp2p/tree/master/examples/protocol-and-stream-muxing Defining your own custom protocols gets tricky when you want to do async blocking communication with binary formats, if you look at the chat example it has a simple text based protocol https://github.com/libp2p/js-libp2p/tree/master/examples/chat This is what sending that arbitrary data is going to look like https://github.com/libp2p/js-libp2p/blob/master/examples/chat/src/dialer.js#L36