createPipeTransport on diffrent nodes

Hi Mediasoup Team !
Im tring to cluster My Project so i do this scenario :
I Have 2 Nodes (Should they be on different hosts):
lets call them nodeA and nodeB
im tring to use createPipeTransport on each and try produce from A to B or reverse of it
so this is what i do :

  1. From A : createPipeTransport()
  2. From B : createPipeTransport()
  3. User want to produce camera for example so first i Connect A to B : this.pipeTransport.connect() then this.pipeTransport.produce()
  4. By signaling server i say to client on B to new Producer and it will try to consume it from B
  5. first i connect B to A : this.pipeTransport.connect()
  6. and try to consume it : await this.pipeTransport.consume()

but i log pipeTransport in B server there is no consumers (Map size is 0)

q1 : am i wrong steps ?
q2 : how can check them connected each other (ip or port is correct or not )

this scenario just for test to find how it works
thnx for your support

  1. You connect both nodes using a PipeTransport in each one. This means you call connect() on both before trying to relay any Producer between them.
  2. Once connected, and once you create a Producer in Node A, do pipeTransport.consume(producerId), and pass the Consumer data (.rtpParameters) to Node B.
  3. In Node B you call pipeTransport.produce() with those rtpParameters.
1 Like

it works now :heart_eyes:
thanks or as we say in persian “Damet Garm” :sweat_smile:

Hi @engi and @ibc
Could you please help me understand the correct flow in this One Piece (mediasoup) setup?

Here’s what I’m currently doing:

  1. Client A is producing media on Server A, and Client B is set up to consume it on Server B.
  2. I’ve created PipeTransport on both servers and connected them using their respective IP and port tuples.
  3. Now I’m a bit stuck:
  • Should I consume the media directly on Server B using the PipeTransport created there?
  • Or should I use pipeToRouter on Server A, passing in the Router from Server B, and then handle the consumption back on Server B?

Which approach is correct for this kind of inter-server setup?

Thanks in advance!

Please, don’t try to fast-track answers by name-dropping people. That’s not how a public forum works.

Yeah, Sure. But i need that piece of information ? Can someone please help me with this ??

You have literally joined this forum 3 hours ago specifically to ask that question. You have mentioned people in your first post to get answers quickly and probably you are not gonna help anyone here. That’s not how a free support community works so I’m sorry but I don’t mind at all that you need that piece of information.

You’re absolutely right about that. I actually joined this forum just 3 hours ago, but I’ve been spending the last 3 weeks exploring it and learning about mediasoup during that time. I couldn’t find much information about how this flow works, which is why I decided to post my question today after looking around for a while. I hope it’s not wrong to ask for such information.

I’m sorry, but I believe there might be a misunderstanding. In order to genuinely help someone, I first need to understand the logic and flow myself. Only then can I effectively support others. I apologize if you find this rude, that wasn’t my intention at all.

  1. You consume Producer on client A in the PlainTransport or server A. That will send the RTP to PlainTransport of server B.
  2. In server B you need to invoke produce() on the PlainTransport of server B with the rtpParameters of the consumer you created on the PlainTransport in server A.
  3. Then also in server B you consume that producer on the WebRtcTransport of client B so client B will receive the RTP.
  4. And of course in client B you need to call recvTransport.consume() as usual.

For simplicity, PipeToRouter exists for the local scenario (mostly testing or simple use case). You should do things manually if this consists of local/remote instances for maximum control.

Imagine Server A and B…

We connect Server A and B pipeTransport first and foremost, next we broadcast(produce) to server A. We take this stream and consume it to pipeTransport for Server B to become a producer. Now you just consume it to any viewers or server till it reaches end-point.

There’s no acknowledgement so you need to sort race conditions and QoS on your own.

Psst. Just copy the flow of PipeToRouter for advanced use.

All set — it’s working perfectly now.