Red5 Documentation

Subscribing with WebRTC

When subscribing with WebRTC it is necessary to use the Stream Manager proxy which will transfer the subscribe request to the edge provided. This is necessary because browsers require that WebRTC uses SSL connections. The proxy avoids to have to deploy a cert on every edge which would be unfeasible when using an autoscale environment, where Red5 Pro instances are spun up dynamically based on load.

The first step to subscribe with WebRTC is to request an edge from the Stream Manger. The request needs to specify the stream name of the variant to which you want to subscribe to. It is recommended to first subscribe to a variant that is in mid-range and then let the edge make any adjustments if necessary. The request to the Stream Manager is as follows:




  • is the host of your Stream Manager.
  • mystream_2: is the name of the stream variant that you want to subscribe to.
  • accessToken: is the token defined in the Stream Manager configuration.

A successful response from the Stream Manager will look like this:

  "serverAddress": "",
  "scope": "live",
  "name": "mystream_2"

This data is then used for the initialization configuration for a RTCSubscriber which will look like the following:

(function (red5prosdk) {

  var subscriber = new red5prosdk.RTCSubscriber()
    host: '',
    app: 'streammanager',
    streamName: 'mystream_2',
    protocol: 'wss',
    port: 443,
    connectionParams: {
      host: '',
      app: 'live'
    subscriptionId: 'subscriber-' + Math.floor(Math.random() * 0x10000).toString(16)
  .then(function () {
  .catch(function (e) {


When the Stream Manager proxy is used in the top-level configuration the app property is assigned as streammanger and a connectionParams object is provided to detail the endpoint to proxy to.