mediasoup on heroku

Hi there,

I have a simple personal dyno on heroku where I deploy mediasoup. My localhost works properly and i can see the videostreams of all connected users. On heroku deployment doesn’t work and unfortunately no errors are thrown. The “video” div element is correctly created, but it’s empty.

I’m wondering if it has to do with the webRTC configuration, does anyone have experience with that?

Here’s my related config:

mediasoup: {
webRtcTransport: {
      listenIps: [
        { ip: '0.0.0.0', announcedIp: '0.0.0.0' }
      ],
      enableUdp: true,
      enableTcp: true,
      preferUdp: true,
      preferTcp: true,
      maxIncomingBitrate: 1500000,
      initialAvailableOutgoingBitrate: 1000000,
    },
    // mediasoup per Peer max sending bitrate (in bps).
    maxBitrate: 500000
  }
}

I hope you have done a previous search about this common issue related to “deploy in a server with private IP”.

The only supported ports/protocols on Heroku are HTTP(s) over ports 80/443:

thank you both for your swift reply!
Heroku (at least the personal plan) doesn’t expose the IP, they document to use 0.0.0.0. You think this is the reason for the hiccup?

Concerning the ports –
I currently have:
rtcMinPort: 40000,
rtcMaxPort: 49999

should this be ?
rtcMinPort: 80,
rtcMaxPort: 443

We write documentation for something:

yes, i read that. But heroku doesn’t expose the HOST_PUBLIC_IP

@robojiannis you are missing the main point that is: Heroku doesn’t allow other protocols different from HTTP(s) from ports different from 80 and 443.

https://webrtc.org/getting-started/overview

Then you should figure it out. Anyway, as @vpalmisano said, you are missing something even more important.

I’ve also been trying to deploy this app on Heroku myself for a week. Sorry to break it to you but IMO I don’t think you can use Heroku. Like vpalmisano said, Heroku blocks all HTTPS (this is not true, edited), therefore you cannot deploy a mediasoup https server . I would recommend using AWS EC2 since they provide a static IP address and you can configure your own environment.

This is far from accurate:

  1. mediasoup does not have any HTTP or HTTPS server.
  2. I have never used Yeroku, but I’m pretty sure that you can deploy a HTTP server on it, even if the TLS (so HTTPS) temination is done by Heroku proxies (no idea, maybe).
  3. @vpalmisano didn’t say that “Heroku blocks all HTTPS”. He clearly says “Heroku doesn’t allow other protocols different from HTTP(s) from ports different from 80 and 443”, which means that you cannot run UDP or TCP ports for ICE/DTLS/RTP.

I suggest you to read this: Introduction to the Real-time Transport Protocol (RTP) - Web APIs | MDN

1 Like

I understand the real problem is the RTP port range now, thank you.