newStream abstract method

Future<P2PStream> newStream(
  1. PeerId p,
  2. List<ProtocolID> pids,
  3. Context context
)

NewStream opens a new stream to given peer p, and writes a p2p/protocol header with given ProtocolID. If there is no connection to p, attempts to create one. If ProtocolID is "", writes no header. (Thread-safe)

If context is not provided, a new Context will be created.

Implementation

Future<P2PStream> newStream(PeerId p, List<ProtocolID> pids, Context context);