# PipeTransporting between different hosts not connected physically

**URL:** <https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507>\
**Category:** mediasoup libraries\
**Created:** [January 6, 2020, 9:03am UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507 "2020-01-06T09:03:20Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![madabhaviamit](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/madabhaviamit/32/1418_2.png) [@madabhaviamit](https://mediasoup.discourse.group/u/madabhaviamit)\
**Post date:** [January 6, 2020, 9:03am UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/1 "2020-01-06T09:03:20Z")

</div>

Hi Team,

I am exploring the PipeTransports APIs of mediasoup, for two host connected to same LAN it is possible to pipe the stream from one host to the another. But, is it possible to use the same PipeTransport mechanisms to pipe the stream from one host to another over internet(two hosts not connected with each other over LAN but are on two different domains on internet)?

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [January 6, 2020, 6:59pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/2 "2020-01-06T18:59:15Z")

</div>

It’s possible but we need to enable SRTP and RTX o those scenarios. Track this issue. We’ll do it eventually as soon as we get some time or some motivation to prioritize this task:

> <https://github.com/versatica/mediasoup/issues/352>
>
> Feature Request
> It should not be that hard to allow SRTP in both PlainRtpTransport and PipeTransport. It's just about adding some srtpCryptoKey...

---

<div class="post-metadata">

**Author:** ![madabhaviamit](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/madabhaviamit/32/1418_2.png) [@madabhaviamit](https://mediasoup.discourse.group/u/madabhaviamit)\
**Post date:** [January 21, 2020, 5:19pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/3 "2020-01-21T17:19:12Z")

</div>

Hi Team,

Thank you so much for considering this🙏🏻

Although i had one thing in my mind, For the time being lets keep this rtp packet loss aside and proceed with the piping between two hosts over internet(say these two hosts are one in US and and other in UK for instance). I have this one to many broadcasting feature and my client is a college in UK, he has like 1000 students who will attend a webinar based lecture. The professor is sitting in US and connected to a mediasoup machine running in US. My client college knows where publisher is publishing(professor). So can i follow the below steps and get the video stream into UKs machine where 1000 students are connected?

Step 1 : create a UKPipeTransport from UK machine and make a http request to US machine sending UKPipeTransport.tuple.localIp, localPort as parameters.

Step 2 : listen to the above request and create USPipeTransport in US machine and connect this USPipeTransport to UKPipeTransport using the localIP, port in the req params(USPipeTransport.connect({ip : UKMachineIP, port : UKMachinePipe port})). also send in response the US machines localIP and port so that UKPipeTransport should be connected to USPipeTransport.

Step 3 : Now make a http request again from UK to US machine to make a pipe producer and send back the rtp params in response. Using these RTP params create a pipe consumer in UK machine with the exact same rtp params…

Following these 3 steps above i should get the video stream from US to UK through piping(assuming this is RTP stream and there could be some packet loss as well)

I hope i am following the documentation here…

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [January 21, 2020, 9:11pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/4 "2020-01-21T21:11:24Z")

</div>

Yes, basically those are the steps. You should also exchange more messages between servers to notify about pipeConsumer “close” or “pause” or “resume”, etc, so you can call close(), pause(), resume() etc in the associated pipeProducer in the other side, etc. Exactly the same that `router.pipeToRouter()` do, so check the code of that method to be sure.

---

<div class="post-metadata">

**Author:** ![madabhaviamit](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/madabhaviamit/32/1418_2.png) [@madabhaviamit](https://mediasoup.discourse.group/u/madabhaviamit)\
**Post date:** [January 28, 2020, 12:26pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/5 "2020-01-28T12:26:11Z")

</div>

Hi,

thanks for the response.

I have tried the above mentioned approach, followed the exact same steps. When i tried to consume the piped stream from one server to another server. The transport disconnected after a few seconds, after going into connecting state. Am i missing something here?

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [January 28, 2020, 12:49pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/6 "2020-01-28T12:49:21Z")

</div>

A PipeTransport just disconnects if you call close() on it (or if the Router that owns it is closed). You may paste the error log anyway.

---

<div class="post-metadata">

**Author:** ![madabhaviamit](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/madabhaviamit/32/1418_2.png) [@madabhaviamit](https://mediasoup.discourse.group/u/madabhaviamit)\
**Post date:** [January 29, 2020, 10:00am UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/7 "2020-01-29T10:00:50Z")

</div>

Hi,

There are no error logs reported on the in the mediasoup client side or at the server side.

I am publishing the stream to ip address 14.140.248.242(Producers are on this VM), and i am subscribing the stream from a different address 34.93.212.173(Consuming the stream on this VM). I have made use of pipe transports to send the producers stream from 14.140.248.242 to 34.93.212.173. All the UDP/TCP ports are kept open.

Below are the screenshot of googCandidatePair

Pair 1 : Producer publishing on 14.140.242.248, It is clearly seen that bytes are being transferred as well as received.

 ![image](https://global.discourse-cdn.com/free1/uploads/mediasoup/original/1X/6a27554ba71325401ee43b35506af38546685456.png)

Pair 2 : Consumers consuming on 34.93.212.173.

 ![image](https://global.discourse-cdn.com/free1/uploads/mediasoup/original/1X/2020228761abb8a146e6459cba1ad116d5177b93.png)

PS : I am using chrome browser, I am sending the stream of my webcam to 14.140.242.248. Then i am trying to consume the same stream in chrome browser by connecting to 34.93.212.173. Before consuming i have piped the streams between both the servers and no errors were observed while doing this pipe mechanism. I also hear a soft static noise in chrome at the consumers side…

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [January 29, 2020, 10:35am UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/8 "2020-01-29T10:35:45Z")

</div>

I’m afraid those legacy stats captures in Chrome are mostly useless to figure out the problem. I don’t know what’s the status of your server side Consumer. Is it paused? have you checked server side `consumer.getStats()`? is `consumer.paused === false`? or is the producer pause? etc etc.

---

<div class="post-metadata">

**Author:** ![madabhaviamit](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/madabhaviamit/32/1418_2.png) [@madabhaviamit](https://mediasoup.discourse.group/u/madabhaviamit)\
**Post date:** [January 29, 2020, 4:06pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/9 "2020-01-29T16:06:18Z")

</div>

Hi,

I will be checking the stats of all pipetransports, pipeProducers and pipeConsumers tomorrow and may send it you for verification if i am doing something wrong.  
For the servers in same VLAN i have achieved the piping of streams. But i still have this question in my mind that whether the PipeTransport will work for two host not connected to each other by LAN and are present anywhere globally accessible over internet.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [January 29, 2020, 4:51pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/10 "2020-01-29T16:51:16Z")

</div>

They should work fine assuming there is network connectivity between them and assuming it’s a perfect link (no packet loss). If not a perfect link you must wait for this takes to be done:

> <https://github.com/versatica/mediasoup/issues/352>
>
> Feature Request
> It should not be that hard to allow SRTP in both PlainRtpTransport and PipeTransport. It's just about adding some srtpCryptoKey...

---

<div class="post-metadata">

**Author:** ![madabhaviamit](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/madabhaviamit/32/1418_2.png) [@madabhaviamit](https://mediasoup.discourse.group/u/madabhaviamit)\
**Post date:** [January 29, 2020, 4:57pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/11 "2020-01-29T16:57:56Z")

</div>

Hi,

What exactly do u mean by network connectivity and perfect link?  
Is it a persistent tcp connection that will be established between those two pipe transports?  
Or is there some physical link between those two servers?

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [January 29, 2020, 5:14pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/12 "2020-01-29T17:14:52Z")

</div>

I just mean that both hosts are connected by a perfect network connection (LAN) without packet loss.

---

<div class="post-metadata">

**Author:** ![madabhaviamit](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/madabhaviamit/32/1418_2.png) [@madabhaviamit](https://mediasoup.discourse.group/u/madabhaviamit)\
**Post date:** [January 29, 2020, 5:27pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/13 "2020-01-29T17:27:27Z")

</div>

Hi,

If there is no physical LAN present between such two hosts, are we saying that piping will not take place? Even though i create two pipe transports and make them connect to each other.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [January 29, 2020, 5:35pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/14 "2020-01-29T17:35:52Z")

</div>

No, I didn’t say that. I just said that piping will just work **fine** if the network connection between both hosts is perfect (no network packet loss) because, as the GitHub issue I referenced explains, currently there is no RTX/NACK (RTP retransmission) in PipeTransports. So if a video packet is lost between both hosts, consumers will get frozen video for 2-3 seconds until they send a RTCP PLI.

---

<div class="post-metadata">

**Author:** ![madabhaviamit](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/madabhaviamit/32/1418_2.png) [@madabhaviamit](https://mediasoup.discourse.group/u/madabhaviamit)\
**Post date:** [January 29, 2020, 5:46pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/15 "2020-01-29T17:46:09Z")

</div>

Thank you for your response.

I am not aware of RTCP PLI, I should brush up on those concepts first. I will do that now also i will be carrying out this considering there will be a packet loss for now.

Do you not believe the way mediasoup is being used for the huge capabilities that it provides with, this feature is required immediately? This could solve so many peoples problem of scalability, piping a stream from one point to another globally no matter if i am connected with a LAN or not. I see in the group 2-3 people apart from me have asked the similar questions.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [January 29, 2020, 6:21pm UTC](https://mediasoup.discourse.group/t/pipetransporting-between-different-hosts-not-connected-physically/507/16 "2020-01-29T18:21:35Z")

</div>

> [@madabhaviamit](#):
>
> Do you not believe the way mediasoup is being used for the huge capabilities that it provides with, this feature is required immediately?

Probably, but we have our jobs and our tasks and our priorities. If some mediasoup users need a feature they can contribute with a PR or with a donation to motivate us to re-prioritize things 😉
