If you are looking for piping within same server then it is really simple as mentioned here in docs:
If you are looking for piping between servers then going through this source code file of mediasoup will help, you can see how they create the piping between routers:
And if you want me to simplify it then here it is:
We have two servers server 1, server 2. Producer 1 is on server 1 and we want this producer to be piped on server 2 so here are the steps:
Create pipetransport on server 1, lets call is pipetransport 1
Create pipetransport on server 2, lets call is pipetransport 2
Exchange connect parameters of pipetransport 1, pipetransport 2 with eachother. Now they are connected
Consume producer 1 on pipetransport 1 (from server 1), now pipetransport 1 is ready to give producer 1 to pipetransport 2
Produce producer 1 on pipetransport 2, with the help of producer parameters from previous step, now pipetransport 2 have producer 1 and so does server 2
Consume producer 1 from server 2 just like normal.