What exactly is the listenIp?

First of all, my sincere gratitude to everyone involved with mediasoup, this is an amazing project and extensively documented.

I have been reading the documentation trying to understand some of the configuration options of mediasoup. I encountered the term “listenIp” in many situations and once i looked at the documentation and followed WebRtcTransportOptions.listenIps-> TransportListenIp[]->ip: “Listening IPv4 or IPv6” i felt like i got nowhere because the only specific information was that it could be ipv4 or ipv6.

So, exactly was it the listenIp used for? At one moment i though that it was the ip of the “unit” in “selective forwarding unit”, in the sense that ot was the ip of the seever used to relay media between peers, now i am beggining to think its the ip of the server used to exchange spd offers between peers, but i think i am still confused.

It is used for listening on IP address for incoming request, this is a standard terminology for any server application

1 Like

In most of the use cases i saw there is a http or webcocket server that receives requests and calls the mediasoup API to create transports and what not, are those the requests you are referring to?

Any server you host will have a listening IP. It’s the IP listening for connections whether it’s an http, ws or media server.

127.0.0.1 is a loop-back address known as LocalHost; if listening to localhost no remote connection can reach the server.

0.0.0.0 is our unkown or no particular address place holder, if used the server will listen on any IP (WAN, LAN and localhost)

Depending on your setup, you may want to only listen on certain IPs if the machine had multiple adapters or security policy requires it.

2 Likes

I guess i get it. But one more question to confirm it, if i setup a websocket in the same node.js app i use with the medisoup module, do i need to set the listenIp to the same ip i used for the websocket server? Or its sufficient that the listenIp is externally reachable?

There’s no requirement that the mediasoup transports use the same listen IP as your websocket. The mediasoup library isn’t concerned with how your app does signaling, and has no concept of websockets or http.

It may very often be the case that the websocket and mediasoup transports use the same IP, but not necessarily. For example, your node websocket listener might be on a private IP that is only accessibly by a load balancer or something that terminates TLS, while your mediasoup transports are listening on publicly accessible IPs.

2 Likes

Yikes… If you can’t answer that for yourself, what are you doing? It’s all documented…

@CosmosisT ts really extensively documented, but that doesn’t mean that it is beginner friendly, thanks for your first answer nonetheless.

1 Like

@jbaudanza thanks for your answer i understand it now, i just need to take a closer look on how webrtc operates specifically.

See the suggested reading here.

1 Like

It’s not intended to be beginner friendly, if you expect that I am sorry but a video-game be easier to make for a beginner…


At least if you learned to program a video-game, you would eventually learn to network them (multi-player) and then want voice communication landing you at RTP… fun all along the way.

@snnz Thank you so much! This is really helpful.