# mediasoup server closes unexpectedly

**URL:** <https://mediasoup.discourse.group/t/mediasoup-server-closes-unexpectedly/535>\
**Category:** mediasoup-demo\
**Created:** [January 22, 2020, 1:02pm UTC](https://mediasoup.discourse.group/t/mediasoup-server-closes-unexpectedly/535 "2020-01-22T13:02:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishnu-sadanandan](https://avatars.discourse-cdn.com/v4/letter/v/b487fb/32.png) [@vishnu-sadanandan](https://mediasoup.discourse.group/u/vishnu-sadanandan)\
**Post date:** [January 22, 2020, 1:02pm UTC](https://mediasoup.discourse.group/t/mediasoup-server-closes-unexpectedly/535/1 "2020-01-22T13:02:23Z")

</div>

Sometimes mediasoup server closes unexpectedly

```auto
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[xx.xx.xx.xx]:55646, error:Error: read ECONNRESET
   at TLSWrap.onStreamRead (internal/stream_base_commons.js:183:27) {
 errno: 'ECONNRESET',
 code: 'ECONNRESET',
 syscall: 'read'
}]

```

---

<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 22, 2020, 2:06pm UTC](https://mediasoup.discourse.group/t/mediasoup-server-closes-unexpectedly/535/2 "2020-01-22T14:06:43Z")

</div>

If you want to make a question make a question. Just pasting random LEGIT logs won’t produce a response or explanation here.

---

<div class="post-metadata">

**Author:** ![vishnu-sadanandan](https://avatars.discourse-cdn.com/v4/letter/v/b487fb/32.png) [@vishnu-sadanandan](https://mediasoup.discourse.group/u/vishnu-sadanandan)\
**Post date:** [February 12, 2020, 8:38am UTC](https://mediasoup.discourse.group/t/mediasoup-server-closes-unexpectedly/535/3 "2020-02-12T08:38:02Z")

</div>

Sorry for the lack of details in the question.

I have been testing mediasoup for one of my projects. For conducting meetings. Usually meetings last for an hour. There will be 3 or 4 peers connecting from different networks. Sometimes the meeting goes smoothly. But most often, mediasoup is getting disconnected and freezes. I checked the mediasoup server log files and is seeing the below error message all the time this issue happens.

```auto
2020-02-11T12:43:14.551Z protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[xx.xx.xx.xx]:xxxx, error:Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:183:27) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read'
}]

```

I have been searching through, to find a cause for this issue. But so far not able to find why this is happening. I have opened up 10,000 ports for this as per its requirement in the server/config.js file.

```auto
        workerSettings: {
            rtcMinPort: 40000,
            rtcMaxPort: 49999
        }

```

Could this be related to any server configurations that mediasoup requires? Any help is greatly appreciated. Thanks in advance.

---

<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:** [February 12, 2020, 12:44pm UTC](https://mediasoup.discourse.group/t/mediasoup-server-closes-unexpectedly/535/4 "2020-02-12T12:44:18Z")

</div>

Actually you are not really testing mediasoup but the mediasoup-demo project, which is just a demo. It uses WebSocket for signaling with client, but WebSocket is NOT part of mediasoup. The error you see just means that a remote client disconnected its WS for whatever reason. Just that.

> [@vishnu-sadanandan](#):
>
> I have opened up 10,000 ports for this as per its requirement in the server/config.js file.

How is that related to WebSocket disconnection? Please, don’t try random things. Read the mediasoup documentation instead and look at the mediasoup-demo code.

> Could this be related to any server configurations that mediasoup requires?

No, there is no magic configuration setting to make the demo work or not.

---

<div class="post-metadata">

**Author:** ![vishnu-sadanandan](https://avatars.discourse-cdn.com/v4/letter/v/b487fb/32.png) [@vishnu-sadanandan](https://mediasoup.discourse.group/u/vishnu-sadanandan)\
**Post date:** [February 14, 2020, 4:23am UTC](https://mediasoup.discourse.group/t/mediasoup-server-closes-unexpectedly/535/5 "2020-02-14T04:23:00Z")

</div>

Thank you very much for pointing out the mistake.
