# Error: connect() already called

**URL:** <https://mediasoup.discourse.group/t/error-connect-already-called/59>\
**Category:** mediasoup libraries\
**Created:** [June 4, 2019, 2:00pm UTC](https://mediasoup.discourse.group/t/error-connect-already-called/59 "2019-06-04T14:00:09Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![mkh](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/mkh/32/145_2.png) [@mkh](https://mediasoup.discourse.group/u/mkh)\
**Post date:** [July 1, 2019, 10:18am UTC](https://mediasoup.discourse.group/t/error-connect-already-called/59/9 "2019-07-01T10:18:30Z")

</div>

I could reproduce the error. When two producers or consumers are created at the same time and over the same transport in the client side then the `transport.on('connect')` event is fired twice. Thus, two simultaneous requests are sent to the server and as a result, dual call to the `transport.connect()` happens.

However the two producers/consumers are connected successfully but better to avoid this somehow, by checking the previous calls to the transport for instance. Checking the `transport.dtlsState`, as I mentioned before, won’t help in this scenario.

---

_[View the full topic](https://mediasoup.discourse.group/t/error-connect-already-called/59)._
