# How to comunicate the C++ Channel with nodejs?

**URL:** <https://mediasoup.discourse.group/t/how-to-comunicate-the-c-channel-with-nodejs/366>\
**Category:** mediasoup libraries\
**Created:** [October 31, 2019, 5:22pm UTC](https://mediasoup.discourse.group/t/how-to-comunicate-the-c-channel-with-nodejs/366 "2019-10-31T17:22:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![avdance](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/avdance/32/143_2.png) [@avdance](https://mediasoup.discourse.group/u/avdance)\
**Post date:** [October 31, 2019, 5:22pm UTC](https://mediasoup.discourse.group/t/how-to-comunicate-the-c-channel-with-nodejs/366/1 "2019-10-31T17:22:46Z")

</div>

I know the nodejs start c++ worker by spawn and create a pipe , but the C++ Channel only create one fd. How to transport command from nodejs to C++ channel? I dont understant it . Can you help me ?

---

<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:** [October 31, 2019, 5:37pm UTC](https://mediasoup.discourse.group/t/how-to-comunicate-the-c-channel-with-nodejs/366/2 "2019-10-31T17:37:58Z")

</div>

It obviously works so, may I know why do you want to know it?

Just in case, we do not help people that take code from mediasoup to build their own private / commercial forks.

---

<div class="post-metadata">

**Author:** ![avdance](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/avdance/32/143_2.png) [@avdance](https://mediasoup.discourse.group/u/avdance)\
**Post date:** [October 31, 2019, 11:56pm UTC](https://mediasoup.discourse.group/t/how-to-comunicate-the-c-channel-with-nodejs/366/3 "2019-10-31T23:56:14Z")

</div>

Ok, Thanks! I want to create a open source project with mediasoup. so I must understand why It can work well by this method. I also wish I can contribue my power for mediasoup in further . I think the mediasoup is very great .

---

<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:** [November 1, 2019, 12:33am UTC](https://mediasoup.discourse.group/t/how-to-comunicate-the-c-channel-with-nodejs/366/4 "2019-11-01T00:33:35Z")

</div>

The mediasoup Node library communicates with each worker process it creates by exchanging JSON messages in both directions via a UnixSocket (a UnixSocket with each worker process). Just that.

---

<div class="post-metadata">

**Author:** ![avdance](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/avdance/32/143_2.png) [@avdance](https://mediasoup.discourse.group/u/avdance)\
**Post date:** [November 1, 2019, 1:33am UTC](https://mediasoup.discourse.group/t/how-to-comunicate-the-c-channel-with-nodejs/366/5 "2019-11-01T01:33:57Z")

</div>

thanks a lot of. I am very sorry! I confused the dev branch with V3 branch yesterday. I view Worker.js in dev branch and view handle/UnixStreamSocket in V3 branch.

---

<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:** [November 1, 2019, 10:10am UTC](https://mediasoup.discourse.group/t/how-to-comunicate-the-c-channel-with-nodejs/366/6 "2019-11-01T10:10:03Z")

</div>

In “devel” branch there is support for Windows so instead of a UnixSocket something else is used, but that’s handled by libuv in a transparent way. However, due to a bug in Node+libuv (that will be fixed in next versions of Node) we had to use two unidirectional “pipes” instead of a single bidirectional “pipe” to make it work in Windows.

---

<div class="post-metadata">

**Author:** ![avdance](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/avdance/32/143_2.png) [@avdance](https://mediasoup.discourse.group/u/avdance)\
**Post date:** [November 1, 2019, 12:59pm UTC](https://mediasoup.discourse.group/t/how-to-comunicate-the-c-channel-with-nodejs/366/7 "2019-11-01T12:59:44Z")

</div>

I see, thank you!

---

<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:** [December 2, 2019, 11:10pm UTC](https://mediasoup.discourse.group/t/how-to-comunicate-the-c-channel-with-nodejs/366/8 "2019-12-02T23:10:59Z")

</div>

Closed on December 2, 2019, 11:10pm UTC


