# Connection state changed to disconnected a few tens of seconds after connected

**URL:** <https://mediasoup.discourse.group/t/connection-state-changed-to-disconnected-a-few-tens-of-seconds-after-connected/3596>\
**Category:** mediasoup libraries\
**Created:** [November 19, 2021, 6:27am UTC](https://mediasoup.discourse.group/t/connection-state-changed-to-disconnected-a-few-tens-of-seconds-after-connected/3596 "2021-11-19T06:27:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![watanabe1113](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@watanabe1113](https://mediasoup.discourse.group/u/watanabe1113)\
**Post date:** [November 19, 2021, 6:27am UTC](https://mediasoup.discourse.group/t/connection-state-changed-to-disconnected-a-few-tens-of-seconds-after-connected/3596/1 "2021-11-19T06:27:47Z")

</div>

Hi,

The client transport connection state goes disconnected a few eights seconds after connection.  
The following log will be output in the chrome console.

“mediasoup-client:Transport connection state changed to connected”

However, the following log will be output in the chrome console a few eights seconds later

“mediasoup-client:Transport connection state changed to disconnected”

If the NewProducer is present before the disconnection, the above will not happen.  
Do you know the possible causes?

---

<div class="post-metadata">

**Author:** ![watanabe1113](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@watanabe1113](https://mediasoup.discourse.group/u/watanabe1113)\
**Post date:** [November 20, 2021, 6:53am UTC](https://mediasoup.discourse.group/t/connection-state-changed-to-disconnected-a-few-tens-of-seconds-after-connected/3596/2 "2021-11-20T06:53:26Z")

</div>

Resolved. I changed the AWS security policy according to the topic below and it worked.

`You’ll also need to configure your AWS Security Group to allow TCP/UDP on whatever port range you’re using.`

> [@Docker setup with listenIps](https://mediasoup.discourse.group/t/docker-setup-with-listenips/2557/4):
>
> Thanks @pixiil I was able to connect that way. You saved me 2 days I’ve now deployed my docker to my AWS EC2 environment under nginx. I’m a little clueless how to get things working. What have tried so far: I’m passing the AWS EC2 public IP as the announceIp and the private Ip of the docker container as the listenIp. This is not working so far. Any idea what else I could try?
