Gateway configuration - Storm JavaScript Library

In this guide, you will learn how to correctly configure all the stream settings for the "gateway" configuration method. You will also find all the parameters that the library can accept, along with their explanations.

Introduction

The gateway method is an alternative to the Embedded configuration and does not require embedding stream data within the config object. Instead, a template containing all stream data (including alternative server list, multiple quality/sources, quality labels etc.) is pushed to the origin server and automatically copied to all edge servers.

For Storm Streaming Cloud all that happens automatically. If you’re about to setup your own streaming cluster using Storm Streaming Server you’ll need to setup an instance with at least one Origin-type application and one Edge-type application (linked together).

Check our Guides for Origin and Edge Applications to learn more.

Thanks to this approach, there is no need to set all stream data for every scenario manually. It is also possible to use inbuilt load-balancing functionality since servers themselves will know which one is under the lowest load or stopped working due to a malfunction.

Basic configuration

                        
const streamConfig = {
    configurationType: "gateway",
    stream: {
        serverList: [{
            host: "yourdomain.com",
            application: "live",
            port: 443,
            ssl: true
        }],
        streamKey: "test",
    },
    settings: {
        autoStart: true,
        video: {
            containerID: "containerID",
            width: "100%",
            aspectRatio: "16:9"
        }
    }
}

//This sample uses IIFE embed method. Creating library instance will look slightly different for AMD, UMD or ESM
const storm = stormLibrary(streamConfig);
                    

Explanation and description of individual fields

Parameter nameParameter typeRequiredDefaultDescription
configurationTypestringyes-This parameter defines whether we are dealing with an 'embedded' or 'gateway' type configuration.
serverList[host]stringyes-A hostname of a Storm Server instance. Since most browsers require SSL for WebSocket connection, using an IP Address is not recommended.
serverList[application]stringyes-A name of an application within the Storm Streaming Server or Storm Cloud instance.
serverList[port]numberno80 for non-ssl and 443 for sslTo avoid issues with network firewalls, please use 80 for non-ssl connections and 443 for ssl connections.
serverList[isSSL]booleannotrueIndicates whether SSL connection should be used or not.
streamKeystringyes-StreamKey of your stream. Usually, a single StreamKey represents a group of streams.
Table 1. Explanation and description of individual fields table

Multiple server configuration

It is possible to define several servers in the configuration object as backup, however the client might end-up connecting to edge server provided by the gateway.

Example:

                        
serverList: [{
        host: "sub1.yourdomain.com",
        application: "live",
        port: 443,
        ssl: true
    },
    {
        host: "sub2.yourdomain.com",
        application: "live",
        port: 443,
        ssl: true
    },
    {
        host: "sub3.yourdomain.com",
        application: "live",
        port: 443,
        ssl: true
    }
]
                    

Multiple source configuration & Adaptive Bitrate Streaming

Just like with the server list, we can add more than one stream source. This gives us two possibilities. If for some reason a given stream doesn't work, Storm Library will simply try to use the next one. We can also use this functionality to launch Adaptive Bitrate Streaming.