NodeJS Simple Conference Host

The Red5 Pro Conference Host is another mock NodeJS example of a WebSocket server for conferencing. It can be used with the Conference Examples from the Red5 Pro Testbed.

You can specify the endpoint for this server when using the Conference Examples using the socket query parameter, e.g., http://localhost:5080/webrtcexamples/test/conference/socket=localhost:8001. This is also defined in the index.js file: var socketEndpoint = window.query('socket') || 'localhost:8001'

Upon connection to the socket with the required parameters, connections are registered and all parties associated with the defined room are notified on previously existing connections. Likewise, when connections are closed, all parties associated with the defined room are notified.


  • NodeJS v10+
  • NPM 6+
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install -y nodejs
sudo apt-get install build-essential
sudo npm install forever -g

The project was developed with the latest NodeJS & NPM as of the time of this writing (April 15th, 2021).


Grab the project: git clone https://github.com/red5pro/red5pro-conference-host

From the root of the repo, run npm install


For most NodeJS implementations, it is necessary to generate SSL certificate files, which are converted into .crt and .key files to be stored in the <service>/cert folder.

Using Let's Encrypt

The following can be run to install Let's Encrypt Certbot on Ubuntu (snap is included with most Ubuntu distributions by default)

  1. sudo snap install core; sudo snap refresh core
  2. sudo snap install --classic certbot
  3. sudo ln -s /snap/bin/certbot /usr/bin/certbot

To generate the cert, run sudo certbot certonly --standalone --email <your-email> --agree-tos -d <server-fqdn> (for example: sudo certbot certonly --standalone --email jessica@infrared5.com --agree-tos -d test01.red5.net)

You will then need to copy the fullchain and privatekey to the cert directory of your application

sudo cp /etc/letsencrypt/archive/<server-fqdn>/fullchain1.pem ~/<nodejs-server>/cert/certificate.crt
sudo cp /etc/letsencrypt/archive/<server-fqdn>/privkey1.pem ~/<nodejs-server>/cert/privateKey.key
sudo chmod +r ~/<nodejs-server>/cert/*

(note: the number will increment as you renew, i.e., fullchain1.pem --> fullchain2.pem, etc.

Your index.js file then needs to be modified with the full path to the certificate and privateKey files (replace with the appropriate paths):

if (useSSL) {
  cert = fs.readFileSync('/home/ubuntu/serverapp/cert/certificate.crt')
  key = fs.readFileSync('/home/ubuntu/serverapp/cert/privateKey.key')
  port = 443


forever start index.js

to view the log location and status of the running process, run forever list

Running the above will start the server on the default port which is defined in index.js


PORT=3000 node index.js

Running the above will start the server on the defined port 3000

Conference Clients


Any connecting clients should provide the following query parameters in the URL when establishing a WebSocket:

  • room: the name of the room to join.
  • streamName: the name of the stream the joining participant will be broadcasting with.


Upon any successful connection, each client associated with a room will be notified of an updated in-memory list of every streamName.

It is important to note that this list will be reflective of all streams which are currently "active" in the room. It will grow as more client connections are made and shrink as client connections are closed.

Each client will be notified of the object with the associated room and a streams list of a JSON Array listing of each streamName. Each streamName is a String.


  room: 'room1',
  streams: ['stream1', 'stream2', 'stream3']