# ICE restart in mediasoup

**URL:** <https://mediasoup.discourse.group/t/ice-restart-in-mediasoup/4546>\
**Category:** mediasoup libraries\
**Created:** [September 9, 2022, 8:57am UTC](https://mediasoup.discourse.group/t/ice-restart-in-mediasoup/4546 "2022-09-09T08:57:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohankumawat001](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@rohankumawat001](https://mediasoup.discourse.group/u/rohankumawat001)\
**Post date:** [September 9, 2022, 8:57am UTC](https://mediasoup.discourse.group/t/ice-restart-in-mediasoup/4546/1 "2022-09-09T08:57:11Z")

</div>

Hi all ,  
Could you please tell me how we can determine when we need to restart ICE which work across all the browser, or If ICE becomes disconnected, is it automatically connected internally

---

<div class="post-metadata">

**Author:** ![BronzedBroth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@BronzedBroth](https://mediasoup.discourse.group/u/BronzedBroth)\
**Post date:** [September 9, 2022, 10:00am UTC](https://mediasoup.discourse.group/t/ice-restart-in-mediasoup/4546/2 "2022-09-09T10:00:42Z")

</div>

I monitor connection state if it disconnects I wait severak seconds to send ice unless user re-connected/etc. So if a user disconnects it is as simple as waiting several seconds allowing re-attempts and sending ice every few seconds till connected. If user is disconnected the server will boot them offline.

Now how you automate the usage of ice is up to you, I am to sorting the best way my self but knowing we must delay it is optimal.

---

<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:** [September 9, 2022, 10:12am UTC](https://mediasoup.discourse.group/t/ice-restart-in-mediasoup/4546/3 "2022-09-09T10:12:16Z")

</div>

Please read the WebRTC W3 spec where those WebRTC core things are defined and documented. This forum is about mediasoup rather than about WebRTC generic topics.

---

<div class="post-metadata">

**Author:** ![rohankumawat001](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@rohankumawat001](https://mediasoup.discourse.group/u/rohankumawat001)\
**Post date:** [September 9, 2022, 10:43am UTC](https://mediasoup.discourse.group/t/ice-restart-in-mediasoup/4546/4 "2022-09-09T10:43:16Z")

</div>

Thanks for reply  
Is transport connection state change events is reliable , and how can we check the current state of ICE in MediaSoup before calling ICE restart ?

---

<div class="post-metadata">

**Author:** ![BronzedBroth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@BronzedBroth](https://mediasoup.discourse.group/u/BronzedBroth)\
**Post date:** [September 9, 2022, 7:37pm UTC](https://mediasoup.discourse.group/t/ice-restart-in-mediasoup/4546/5 "2022-09-09T19:37:13Z")

</div>

Yes the transport’s connectionstatechange is very reliable, the client will know before the host that they  
needs ice.

Checking the current state is not necessary, just have the server complete the request and return the ice to the client. If you’re worried about misbehaving clients just throwing ICE out the window ( hahaha) then you could rate-limit this feature. For instance if a room has 24 broadcasts, that could be limited to 48 ice requests a minute. Just an idea.
