Go to file
Joachim Bauch f8eae0b71f
Merge pull request #683 from strukturag/dependabot/go_modules/github.com/nats-io/nats-server/v2-2.10.12
build(deps): Bump github.com/nats-io/nats-server/v2 from 2.10.11 to 2.10.12
2024-03-18 09:07:35 +01:00
.github CI: Check continentmap if related files are changed. 2024-03-11 10:42:57 +01:00
client Switch to atomic types from Go 1.19 2023-10-30 09:32:46 +01:00
dist/init/systemd remove @resources from SystemCallFilter 2022-08-19 12:34:51 +02:00
docker docker: Add helper scripts to gracefully stop / wait for proxy. 2024-02-28 22:52:54 +01:00
docs build(deps): Bump markdown from 3.5.2 to 3.6 in /docs 2024-03-14 20:40:09 +00:00
proxy Reuse backoff waiting code for initial proxy MCU connection. 2024-02-27 16:42:06 +01:00
scripts Update source of continentmap to original CSV file. 2024-03-11 10:42:56 +01:00
server Need to start DNS monitor. 2024-02-27 08:50:37 +01:00
.dockerignore Add official docker images. 2022-08-05 15:32:10 +02:00
.gitignore Add initial clustering support. 2022-06-30 11:35:28 +02:00
.golangci.yml lint: Disable rule "indent-error-flow". 2023-10-26 09:53:39 +02:00
.readthedocs.yaml CI: Pin dependencies to fix readthedocs build. 2022-04-04 15:54:37 +02:00
CHANGELOG.md Update changelog for 1.2.3 2024-01-31 09:35:31 +01:00
LICENSE Initial commit of the OpenSource version. 2020-05-12 09:46:20 +02:00
Makefile make: Don't update dependencies but use pinned versions. 2024-03-06 08:27:46 +01:00
README.md Fix link to NATS install docs 2024-01-16 14:23:11 +01:00
allowed_ips.go Add missing copyright headers. 2023-12-21 16:07:20 +01:00
allowed_ips_test.go Add missing copyright headers. 2023-12-21 16:07:20 +01:00
api_async.go Pass along dialout status through transient data. 2023-10-26 09:53:58 +02:00
api_backend.go Pass along dialout status through transient data. 2023-10-26 09:53:58 +02:00
api_backend_test.go Implement message handler for dialout support. 2023-10-26 09:53:57 +02:00
api_grpc.go Allow configuring GRPC targets through etcd. 2022-06-30 11:35:32 +02:00
api_proxy.go Calculate proxy load based on maximum bandwidth. 2024-02-27 15:20:17 +01:00
api_signaling.go Strongly type "StreamType". 2024-02-27 15:20:14 +01:00
api_signaling_test.go Add hello version "2.0" that authenticates connections using a JWT. 2022-08-03 16:33:45 +02:00
async_events.go Trigger "joined" events through async messages. 2022-06-24 13:37:37 +02:00
async_events_nats.go Use empty struct for close channel. 2023-02-22 08:34:14 +01:00
async_events_test.go Refactor asynchronous events to central location. 2022-06-24 13:37:35 +02:00
backend_client.go Improve handling of throttled responses from Nextcloud. 2023-01-17 13:33:47 +01:00
backend_client_test.go Improve handling of throttled responses from Nextcloud. 2023-01-17 13:33:47 +01:00
backend_configuration.go Implement per-backend session limit for clusters. 2022-07-13 11:52:20 +02:00
backend_configuration_stats_prometheus.go Add more metrics on rooms / sessions / backends. 2021-08-10 08:50:41 +02:00
backend_configuration_test.go Fallback to common shared secret if none is set for backends. 2023-08-08 10:54:47 +02:00
backend_server.go Support old-style compat backend configurations. 2023-10-31 08:53:06 +01:00
backend_server_test.go Use DNS monitor from static GRPC clients configuration. 2024-01-30 17:03:45 +01:00
backend_storage_etcd.go Reuse backoff waiting code in etcd clients. 2024-02-27 16:27:17 +01:00
backend_storage_etcd_test.go Use "struct{}" channel if only used as signaling mechanism. 2023-06-15 11:30:28 +02:00
backend_storage_static.go Fallback to common shared secret if none is set for backends. 2023-08-08 10:54:47 +02:00
backoff.go Add helper to wait with exponential backoff. 2022-07-01 10:21:49 +02:00
backoff_test.go Add helper to wait with exponential backoff. 2022-07-01 10:21:49 +02:00
capabilities.go Update capabilities if no hello v2 token key is found in cache. 2022-08-04 08:55:21 +02:00
capabilities_test.go Switch to atomic types from Go 1.19 2023-10-30 09:32:46 +01:00
certificate_reloader.go Add certificate reloader class. 2022-07-04 10:50:44 +02:00
certificate_reloader_test.go Add certificate reloader class. 2022-07-04 10:50:44 +02:00
channel_waiter.go Add helper class for channel waiters. 2023-02-22 08:34:16 +01:00
channel_waiter_test.go Add helper class for channel waiters. 2023-02-22 08:34:16 +01:00
client.go Switch to atomic types from Go 1.19 2023-10-30 09:32:46 +01:00
client_stats_prometheus.go Add more metrics on rooms / sessions / backends. 2021-08-10 08:50:41 +02:00
clientsession.go Strongly type "StreamType". 2024-02-27 15:20:14 +01:00
clientsession_test.go Strongly type "StreamType". 2024-02-27 15:20:14 +01:00
closer.go Switch to atomic types from Go 1.19 2023-10-30 09:32:46 +01:00
closer_test.go Add helper class to handle close channels. 2023-02-22 08:34:15 +01:00
concurrentmap.go Switch dependency tracking to Go modules. 2021-04-09 16:15:00 +02:00
concurrentmap_test.go Switch dependency tracking to Go modules. 2021-04-09 16:15:00 +02:00
config.go Move common option list parsing code to own function. 2023-12-07 13:33:54 +01:00
config_test.go Move common option list parsing code to own function. 2023-12-07 13:33:54 +01:00
continentmap.go Update source of continentmap to original CSV file. 2024-03-11 10:42:56 +01:00
deferred_executor.go Simplify stopping of deferred executor. 2023-02-22 08:34:11 +01:00
deferred_executor_test.go Use "struct{}" channel if only used as signaling mechanism. 2023-06-15 11:30:28 +02:00
dns_monitor.go Split port from hostname in full urls. 2024-02-27 08:53:03 +01:00
dns_monitor_test.go Split port from hostname in full urls. 2024-02-27 08:53:03 +01:00
etcd_client.go Reuse backoff waiting code in etcd clients. 2024-02-27 16:27:17 +01:00
etcd_client_test.go Reuse backoff waiting code in etcd clients. 2024-02-27 16:27:17 +01:00
flags.go Move common flags code to own struct. 2023-10-30 10:13:17 +01:00
flags_test.go Move common flags code to own struct. 2023-10-30 10:13:17 +01:00
geoip.go Stop using deprecated ioutil package. 2022-04-05 12:48:27 +02:00
geoip_test.go Stop using deprecated ioutil package. 2022-04-05 12:48:27 +02:00
gnatsd.conf Initial commit of the OpenSource version. 2020-05-12 09:46:20 +02:00
go.mod build(deps): Bump github.com/nats-io/nats-server/v2 2024-03-13 20:22:46 +00:00
go.sum build(deps): Bump github.com/nats-io/nats-server/v2 2024-03-13 20:22:46 +00:00
grpc_backend.proto Implement per-backend session limit for clusters. 2022-07-13 11:52:20 +02:00
grpc_client.go Reuse backoff waiting code in etcd clients. 2024-02-27 16:27:17 +01:00
grpc_client_test.go Add locking to "wakeupChanForTesting" of GRPC clients. 2024-01-30 17:03:46 +01:00
grpc_common.go grpc: Always use reloadable credentials. 2022-07-08 09:34:17 +02:00
grpc_common_test.go Make sure replaced files have different modification times. 2022-07-08 10:06:15 +02:00
grpc_internal.proto grpc: Automatically detect if a target is the current server itself. 2022-06-30 11:35:35 +02:00
grpc_mcu.proto Add initial clustering support. 2022-06-30 11:35:28 +02:00
grpc_server.go Strongly type "StreamType". 2024-02-27 15:20:14 +01:00
grpc_server_test.go Make sure replaced files have different modification times. 2022-07-08 10:06:15 +02:00
grpc_sessions.proto Disconnect sessions with the same room session id synchronously. 2022-07-11 10:39:06 +02:00
grpc_stats_prometheus.go Add metrics for GRPC calls. 2022-06-30 11:35:31 +02:00
http_client_pool.go Add metrics for current number of HTTP client connections. 2024-02-27 09:14:49 +01:00
http_client_pool_stats_prometheus.go Add metrics for current number of HTTP client connections. 2024-02-27 09:14:49 +01:00
http_client_pool_test.go Move capabilities handling to own file and refactor http client pool. 2022-05-13 09:20:31 +02:00
hub.go Reuse backoff waiting code for errors during GeoIP update. 2024-02-27 16:15:42 +01:00
hub_stats_prometheus.go Add more metrics on rooms / sessions / backends. 2021-08-10 08:50:41 +02:00
hub_test.go Use DNS monitor from static GRPC clients configuration. 2024-01-30 17:03:45 +01:00
janus_client.go Switch to atomic types from Go 1.19 2023-10-30 09:32:46 +01:00
lru.go Switch dependency tracking to Go modules. 2021-04-09 16:15:00 +02:00
lru_test.go Switch dependency tracking to Go modules. 2021-04-09 16:15:00 +02:00
mcu_common.go Calculate proxy load based on maximum bandwidth. 2024-02-27 15:20:17 +01:00
mcu_common_test.go Lint prometheus stats. 2021-08-10 08:50:40 +02:00
mcu_janus.go Calculate proxy load based on maximum bandwidth. 2024-02-27 15:20:17 +01:00
mcu_janus_test.go Lint prometheus stats. 2021-08-10 08:50:40 +02:00
mcu_proxy.go Calculate proxy load based on maximum bandwidth. 2024-02-27 15:20:17 +01:00
mcu_proxy_test.go Update tests for new continent map. 2021-12-06 09:31:06 +01:00
mcu_stats_prometheus.go Also track subscriber streams by type. 2021-08-10 08:50:40 +02:00
mcu_test.go Calculate proxy load based on maximum bandwidth. 2024-02-27 15:20:17 +01:00
mkdocs.yml Add documentation on the available metrics. 2022-03-17 10:17:15 +01:00
mock_data_test.go Add missing copyright headers. 2023-12-21 16:07:20 +01:00
natsclient.go Reuse backoff waiting code in NATS client. 2024-02-27 16:12:04 +01:00
natsclient_loopback.go Remove unnecessary variable to flag closed loopback client. 2023-02-22 08:34:13 +01:00
natsclient_loopback_test.go Run function to test for goroutine leaks as subtest. 2023-01-17 14:51:02 +01:00
natsclient_test.go Switch to atomic types from Go 1.19 2023-10-30 09:32:46 +01:00
notifier.go Use simpler implementation without Context for notifier. 2023-02-22 08:34:14 +01:00
notifier_test.go Support multiple waiters for the same key. 2021-06-07 14:36:52 +02:00
proxy.conf.in Move etcd configuration to common section. 2022-06-24 11:15:29 +02:00
proxy_config.go Use DNS monitor from static proxy configuration. 2024-01-30 17:03:43 +01:00
proxy_config_etcd.go Reuse backoff waiting code in etcd clients. 2024-02-27 16:27:17 +01:00
proxy_config_etcd_test.go Add missing copyright headers. 2023-12-21 13:43:57 +01:00
proxy_config_static.go Stopping the static proxy config should unregister from DNS monitor. 2024-02-22 14:06:05 +01:00
proxy_config_static_test.go Fix flaky "TestProxyConfigStaticDNS". 2024-02-27 15:10:42 +01:00
proxy_config_test.go Fix race condition when accessing "expected" in proxy_config tests. 2024-02-07 10:01:12 +01:00
room.go Pass along dialout status through transient data. 2023-10-26 09:53:58 +02:00
room_ping.go Migrate to closer helper class. 2023-02-22 08:34:15 +01:00
room_ping_test.go Allow configuring backends through etcd. 2022-06-30 11:35:36 +02:00
room_stats_prometheus.go Add more metrics on rooms / sessions / backends. 2021-08-10 08:50:41 +02:00
room_test.go Refactor asynchronous events to central location. 2022-06-24 13:37:35 +02:00
roomsessions.go Disconnect sessions with the same room session id synchronously. 2022-07-11 10:39:06 +02:00
roomsessions_builtin.go Update entry if room session id changes. 2023-09-05 15:23:19 +02:00
roomsessions_builtin_test.go Add initial clustering support. 2022-06-30 11:35:28 +02:00
roomsessions_test.go Update entry if room session id changes. 2023-09-05 15:23:19 +02:00
server.conf.in Fallback to common shared secret if none is set for backends. 2023-08-08 10:54:47 +02:00
session.go Add "permission" for sessions that may not receive display names. 2022-04-26 14:47:01 +02:00
session_test.go Mark functions as test helpers. 2023-01-18 15:43:32 +01:00
single_notifier.go Use simpler implementation without Context for notifier. 2023-02-22 08:34:14 +01:00
single_notifier_test.go Add SingleNotifier class. 2022-06-30 11:35:29 +02:00
stats_prometheus.go Add prometheus metrics. 2021-08-10 08:50:39 +02:00
stats_prometheus_test.go Add more metrics on rooms / sessions / backends. 2021-08-10 08:50:41 +02:00
syscallconn.go Explicitly use type "sysConn". 2023-02-07 09:04:35 +01:00
testclient_test.go Add lock for TestClient connections to support writing from multiple goroutines. 2023-10-26 10:58:59 +02:00
testutils_test.go Dump previous goroutines if leakcheck fails. 2023-12-07 12:04:29 +01:00
tools.go Simplify vendoring. 2023-06-07 17:26:32 +02:00
transient_data.go Support TTL for transient data. 2023-10-12 11:07:10 +02:00
transient_data_test.go Support passing TTL when setting transient data from clients. 2023-10-12 11:07:11 +02:00
vendor_helper_test.go Simplify vendoring. 2023-06-07 17:26:32 +02:00
virtualsession.go Hangup virtual session if it gets disinvited. 2023-12-07 14:38:01 +01:00
virtualsession_test.go Move common flags code to own struct. 2023-10-30 10:13:17 +01:00

README.md

Spreed standalone signaling server

Build Status Coverage Status Documentation Status Go Report

This repository contains the standalone signaling server which can be used for Nextcloud Talk (https://apps.nextcloud.com/apps/spreed).

See https://nextcloud-spreed-signaling.readthedocs.io/en/latest/ for further information on the API of the signaling server.

Building

The following tools are required for building the signaling server.

  • git
  • go >= 1.20
  • make
  • protobuf-compiler >= 3

Usually the last two versions of Go are supported. This follows the release policy of Go: https://go.dev/doc/devel/release#policy

All other dependencies are fetched automatically while building.

$ make build

or on FreeBSD

$ gmake build

Afterwards the binary is created as bin/signaling.

Configuration

A default configuration file is included as server.conf.in. Copy this to server.conf and adjust as necessary for the local setup. See the file for comments about the different parameters that can be changed.

Running

The signaling server connects to a NATS server (https://nats.io/) to distribute messages between different instances. See the NATS documentation on how to set up a server and run it.

Once the NATS server is running (and the URL to it is configured for the signaling server), you can start the signaling server.

$ ./bin/signaling

By default, the configuration is loaded from server.conf in the current directory, but a different path can be passed through the --config option.

$ ./bin/signaling --config /etc/signaling/server.conf

Running as daemon

systemd

Create a dedicated group and user:

sudo groupadd --system signaling
sudo useradd --system \
    --gid signaling \
    --shell /usr/sbin/nologin \
    --comment "Standalone signaling server for Nextcloud Talk." \
    signaling

Copy server.conf.in to /etc/signaling/server.conf and fix permissions:

sudo chmod 600 /etc/signaling/server.conf
sudo chown signaling: /etc/signaling/server.conf

Copy dist/init/systemd/signaling.service to /etc/systemd/system/signaling.service (adjust abs. path in ExecStart to match your binary location!)

Enable and start service:

systemctl enable signaling.service
systemctl start signaling.service

Running with Docker

Official docker containers for the signaling server and -proxy are available on Docker Hub at https://hub.docker.com/r/strukturag/nextcloud-spreed-signaling

See the README.md in the docker subfolder for details.

Docker Compose

You will likely have to adjust the Janus command line options depending on the exact network configuration on your server. Refer to Setup of Janus and the Janus documentation for how to configure your Janus server.

Copy server.conf.in to server.conf and adjust it to your liking.

If you're using the docker-compose.yml configuration as is, the MCU Url must be set to ws://localhost:8188, the NATS Url must be set to nats://localhost:4222, and TURN Servers must be set to turn:localhost:3478?transport=udp,turn:localhost:3478?transport=tcp.

docker-compose build
docker-compose up -d

Please note that docker-compose v2 is required for building while most distributions will ship older versions. You can download a recent version from https://docs.docker.com/compose/install/

Setup of NATS server

There is a detailed description on how to install and run the NATS server available at https://docs.nats.io/running-a-nats-service/introduction

You can use the gnatsd.conf file as base for the configuration of the NATS server.

Setup of Janus

A Janus server (from https://github.com/meetecho/janus-gateway) can be used to act as a WebRTC gateway. See the documentation of Janus on how to configure and run the server. At least the VideoRoom plugin and the websocket transport of Janus must be enabled.

The signaling server uses the VideoRoom plugin of Janus to manage sessions. All gateway details are hidden from the clients, all messages are sent through the signaling server. Only WebRTC media is exchanged directly between the gateway and the clients.

Edit the server.conf and enter the URL to the websocket endpoint of Janus in the section [mcu] and key url. During startup, the signaling server will connect to Janus and log information of the gateway.

The maximum bandwidth per publishing stream can also be configured in the section [mcu], see properties maxstreambitrate and maxscreenbitrate.

Use multiple Janus servers

To scale the setup and add high availability, a signaling server can connect to one or multiple proxy servers that each provide access to a single Janus server.

For that, set the type key in section [mcu] to proxy and set url to a space-separated list of URLs where a proxy server is running.

Each signaling server that connects to a proxy needs a unique token id and a public / private RSA keypair. The token id must be configured as token_id in section [mcu], the path to the private key file as token_key.

Setup of proxy server

The proxy server is built with the standard make command make build as bin/proxy binary. Copy the proxy.conf.in as proxy.conf and edit section [tokens] to the list of allowed token ids and filenames of the public keys for each token id. See the comments in proxy.conf.in for other configuration options.

When the proxy process receives a SIGHUP signal, the list of allowed token ids / public keys is reloaded. A SIGUSR1 signal can be used to shutdown a proxy process gracefully after all clients have been disconnected. No new publishers will be accepted in this case.

Clustering

The signaling server supports a clustering mode where multiple running servers can be interconnected to form a single "virtual" server. This can be used to increase the capacity of the signaling server or provide a failover setup.

For that a central NATS server / cluster must be used by all instances. Each instance must run a GRPC server (enable listening in section grpc and optionally setup certificate, private key and CA). The list of other GRPC targets must be configured as targets in section grpc or can be retrieved from an etcd cluster. See server.conf.in in section grpc for configuration details.

Setup of frontend webserver

Usually the standalone signaling server is running behind a webserver that does the SSL protocol or acts as a load balancer for multiple signaling servers.

The configuration examples below assume a pre-configured webserver (nginx or Apache) with a working HTTPS setup, that is listening on the external interface of the server hosting the standalone signaling server.

After everything has been set up, the configuration can be tested using curl:

$ curl -i https://myserver.domain.invalid/standalone-signaling/api/v1/welcome
HTTP/1.1 200 OK
Date: Thu, 05 Jul 2018 09:28:08 GMT
Server: nextcloud-spreed-signaling/1.0.0
Content-Type: application/json; charset=utf-8
Content-Length: 59

{"nextcloud-spreed-signaling":"Welcome","version":"1.0.0"}

nginx

Nginx can be used as frontend for the standalone signaling server without any additional requirements.

The backend should be configured separately so it can be changed in a single location and also to allow using multiple backends from a single frontend server.

Assuming the standalone signaling server is running on the local interface on port 8080 below, add the following block to the nginx server definition in /etc/nginx/sites-enabled (just before the server definition):

upstream signaling {
    server 127.0.0.1:8080;
}

To proxy all requests for the standalone signaling to the correct backend, the following location block must be added inside the server definition of the same file:

location /standalone-signaling/ {
    proxy_pass http://signaling/;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /standalone-signaling/spreed {
    proxy_pass http://signaling/spreed;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Example (e.g. /etc/nginx/sites-enabled/default):

upstream signaling {
    server 127.0.0.1:8080;
}

server {
    listen 443 ssl http2;
    server_name myserver.domain.invalid;

    # ... other existing configuration ...

    location /standalone-signaling/ {
        proxy_pass http://signaling/;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location /standalone-signaling/spreed {
        proxy_pass http://signaling/spreed;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Apache

To configure the Apache webservice as frontend for the standalone signaling server, the modules mod_proxy_http and mod_proxy_wstunnel must be enabled so WebSocket and API backend requests can be proxied:

$ sudo a2enmod proxy
$ sudo a2enmod proxy_http
$ sudo a2enmod proxy_wstunnel

Now the Apache VirtualHost configuration can be extended to forward requests to the standalone signaling server (assuming the server is running on the local interface on port 8080 below):

<VirtualHost *:443>

    # ... existing configuration ...

    # Enable proxying Websocket requests to the standalone signaling server.
    ProxyPass "/standalone-signaling/"  "ws://127.0.0.1:8080/"

    RewriteEngine On
    # Websocket connections from the clients.
    RewriteRule ^/standalone-signaling/spreed/$ - [L]
    # Backend connections from Nextcloud.
    RewriteRule ^/standalone-signaling/api/(.*) http://127.0.0.1:8080/api/$1 [L,P]

    # ... existing configuration ...

</VirtualHost>

Caddy

v1

Caddy (v1) configuration:

myserver.domain.invalid {
  proxy /standalone-signaling/ http://127.0.0.1:8080 {
    without /standalone-signaling
    transparent
    websocket
  }
}

v2

Caddy (v2) configuration:

myserver.domain.invalid {
  route /standalone-signaling/* {
    uri strip_prefix /standalone-signaling
    reverse_proxy http://127.0.0.1:8080
  }
}

Setup of Nextcloud Talk

Login to your Nextcloud as admin and open the additional settings page. Scroll down to the "Talk" section and enter the base URL of your standalone signaling server in the field "External signaling server". Please note that you have to use https if your Nextcloud is also running on https. Usually you should enter https://myhostname/standalone-signaling as URL.

The value "Shared secret for external signaling server" must be the same as the property secret in section backend of your server.conf.

If you are using a self-signed certificate for development, you need to uncheck the box Validate SSL certificate so backend requests from Nextcloud to the signaling server can be performed.

Benchmarking the server

A simple client exists to benchmark the server. Please note that the features that are benchmarked might not cover the whole functionality, check the implementation in src/client for details on the client.

To authenticate new client connections to the signaling server, the client starts a dummy authentication handler on a local interface and passes the URL in the hello request. Therefore the signaling server should be configured to allow all backend hosts (option allowall in section backend).

The client is not compiled by default, but can be using the client target:

$ make client

Usage:

$ ./bin/client
Usage of ./bin/client:
  -addr string
        http service address (default "localhost:28080")
  -config string
        config file to use (default "server.conf")
  -maxClients int
        number of client connections (default 100)

Running multiple signaling servers

IMPORTANT: This is considered experimental and might not work with all functionality of the signaling server, especially when using the Janus integration.

The signaling server uses the NATS server to send messages to peers that are not connected locally. Therefore multiple signaling servers running on different hosts can use the same NATS server to build a simple cluster, allowing more simultaneous connections and distribute the load.

To set this up, make sure all signaling servers are using the same settings for their session keys and the secret in the backend section. Also the URL to the NATS server (option url in section nats) must point to the same NATS server.

If all this is setup correctly, clients can connect to either of the signaling servers and exchange messages between them.