Questions about required ordering of things in Pipe to Router

I’m wrapping my head around re-purposing the code from pipeToRouter to use with hosts across different machines.

I have some qs regarding the code/ordering of things.

When creating pipe transports, are they unidirectional or bi-directional? Do you need to create separate pipe transports for each direction of media streaming flow? For example if router a is piping to router b, and router b wants to pipe to router a, can you use the same pipe transport pair in a bidirectional matter, or do you need to create a separate pipe transport pair for each direction of media stream flow?

The order in pipeToRouter works as follows:

  • create pipe transport pair,
  • connect both pipe transports.
  • create pipe consumer on router and pipe transport of producing peer
  • create pipe producer on router and pipe transport of consuming peer

Do both transports need to be connected before creating the pipe consumer? i.e. does the producing peer’s pipe transport need to wait for the consuming peer’s pipe transport to be connected before creating the consumer?

Does the consuming peer’s pipe transport need to wait for the producing peer’s pipe transport to create the pipe consumer before creating the pipe producer?

I ask because I’m wondering if its possible to do the following, which would require the least amount of handshaking:

  • In producing peer’s router: create pipe transport, connect it, create pipe consumer.
  • Concurrently In consuming peer’s router: create pipe transport, connect it, create pipe producer.

All transports in mediasoup are (or can be bidirectional). An exception is WebRtcTransports when used with mediasoup-client due to internal design.

No.