# Get Candidate type:relay using Mediasoup getStats API

**URL:** <https://mediasoup.discourse.group/t/get-candidate-type-relay-using-mediasoup-getstats-api/4908>\
**Category:** mediasoup libraries\
**Created:** [February 1, 2023, 11:58am UTC](https://mediasoup.discourse.group/t/get-candidate-type-relay-using-mediasoup-getstats-api/4908 "2023-02-01T11:58:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![j4gd33p](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/j4gd33p/32/2683_2.png) [@j4gd33p](https://mediasoup.discourse.group/u/j4gd33p)\
**Post date:** [February 1, 2023, 11:58am UTC](https://mediasoup.discourse.group/t/get-candidate-type-relay-using-mediasoup-getstats-api/4908/1 "2023-02-01T11:58:26Z")

</div>

We need to identify peers who connecting through TURN. In normal webrtc, we accomplish that by calling peerConnection.getStats() and then filtering the candidate-pair whose candidateType is relay.

How we can do the same in mediasoup using its stats API ?

I tried several things but not getting the desired response

---

<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 1, 2023, 12:04pm UTC](https://mediasoup.discourse.group/t/get-candidate-type-relay-using-mediasoup-getstats-api/4908/2 "2023-02-01T12:04:59Z")

</div>

As stated in the docs mediasoup is a ICE Lite endpoint so it doesn’t know whether client chose TURN or not. The way to discover it in mediasoup side is by inspecting the selected candidate IP and matching it against well known TURN IPs.
