No description
  • Go 98%
  • Shell 1.2%
  • Makefile 0.3%
  • Python 0.3%
  • Dockerfile 0.2%
Find a file
2025-11-06 20:41:53 +01:00
.github Bump the artifacts group with 2 updates 2025-10-24 20:01:43 +00:00
api Add type to store bandwidths. 2025-11-06 10:57:23 +01:00
client Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
dist/init/systemd Add "/usr/lib64" to systemd ExecPath 2025-04-09 16:57:37 +02:00
docker dockerfile: create system user (uid <= 999) instead of normal user (uid >= 1000), avoid home directory 2025-08-21 19:12:19 +08:00
docs Add metrics for candidates and ICE, DTLS and PeerConnection states. 2025-11-06 20:41:53 +01:00
internal Add type to store bandwidths. 2025-11-06 10:57:23 +01:00
proxy Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
scripts Fix shellcheck error. 2025-04-24 08:37:30 +02:00
server Merge pull request #1078 from strukturag/gvisor-checklocks 2025-10-23 11:35:58 +02:00
.codecov.yml codecov: Add fallback "root" module. 2025-09-29 21:44:30 +02:00
.dockerignore Add official docker images. 2022-08-05 15:32:10 +02:00
.gitignore Explicitly set TMPDIR to ensure that it is a path where go-installed utils (pe. easyjson-bootstrap) can be executed. Fixes #955 2025-04-01 15:43:59 +02:00
.golangci.yml CI: Disable "stdversion" check of govet. 2025-09-26 21:10:51 +02:00
.readthedocs.yaml docs: Use the latest LTS of Ubuntu and Python 3.12. 2024-07-31 09:24:54 +02:00
allowed_ips.go Also allow access from ::1 by default. 2025-10-08 10:43:32 +02:00
allowed_ips_test.go Switch to "github.com/stretchr/testify" for tests. 2024-09-03 13:50:52 +02:00
api_async.go Use dedicated type for "ClientType". 2025-09-09 12:00:34 +02:00
api_async_easyjson.go Update generated files from bee1175198 2025-09-15 20:04:04 +00:00
api_backend.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
api_backend_easyjson.go Update generated files. 2025-11-06 10:57:25 +01:00
api_backend_test.go Improve detecting duplicate backend URLs in etcd configuration. 2025-07-17 14:36:32 +02:00
api_grpc.go Allow configuring GRPC targets through etcd. 2022-06-30 11:35:32 +02:00
api_grpc_easyjson.go Update generated files from bee1175198 2025-09-15 20:04:04 +00:00
api_proxy.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
api_proxy_easyjson.go Update generated files. 2025-11-06 10:57:25 +01:00
api_signaling.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
api_signaling_easyjson.go Update generated files. 2025-11-06 10:57:25 +01:00
api_signaling_test.go Implement relaying of chat messages. 2025-09-29 14:19:00 +02:00
async_events.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
async_events_nats.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
async_events_test.go nats: Reconnect client indefinitely. 2025-03-05 16:41:11 +01:00
backend_client.go modernize: Replace "interface{}" with "any". 2025-07-30 09:44:18 +02:00
backend_client_stats_prometheus.go Add metrics for backend client requests. 2025-04-17 08:28:41 +02:00
backend_client_test.go Switch to "github.com/stretchr/testify" for tests. 2024-09-03 13:50:52 +02:00
backend_configuration.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
backend_configuration_stats_prometheus.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
backend_configuration_test.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
backend_server.go Protect access to the debug pprof handlers. 2025-10-08 10:46:06 +02:00
backend_server_test.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
backend_storage_etcd.go Fix counting of backends for metrics. 2025-07-17 16:13:44 +02:00
backend_storage_etcd_test.go Switch to "github.com/stretchr/testify" for tests. 2024-09-03 13:50:52 +02:00
backend_storage_static.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
backoff.go Use "testing/synctest" to simplify timing-dependent tests. 2025-09-09 11:33:32 +02:00
backoff_test.go Use "testing/synctest" to simplify timing-dependent tests. 2025-09-09 11:33:32 +02:00
buffer_pool.go Add buffer pool helper class. 2025-04-16 10:22:56 +02:00
capabilities.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
capabilities_test.go Move "StringMap" class to api module. 2025-09-26 13:50:18 +02:00
certificate_reloader.go Close file watcher on shutdown to prevent goroutine leaks. 2024-04-23 10:53:28 +02:00
certificate_reloader_test.go Fix race condition in flaky certificate/CA reload tests. 2025-04-16 13:57:13 +02:00
CHANGELOG.md Update changelog for 2.0.4 2025-08-18 10:59:59 +02:00
channel_waiter.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
channel_waiter_test.go Switch to "github.com/stretchr/testify" for tests. 2024-09-03 13:50:52 +02:00
client.go Add metric for RTT of WebSocket ping messages. 2025-11-06 20:41:52 +01:00
client_stats_prometheus.go Add metric for RTT of WebSocket ping messages. 2025-11-06 20:41:52 +01:00
clientsession.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
clientsession_test.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
closer.go Switch to atomic types from Go 1.19 2023-10-30 09:32:46 +01:00
closer_test.go Modernize Go code and check from CI. 2025-08-14 09:23:25 +02:00
concurrentmap.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
concurrentmap_test.go Add dedicated types for different session ids. 2025-09-09 11:38:47 +02:00
config.go Simlify splitting string into non-empty entries. 2025-08-14 16:54:28 +02:00
config_test.go Switch to "github.com/stretchr/testify" for tests. 2024-09-03 13:50:52 +02:00
continentmap.go Rebuild continentmap 2024-10-28 11:48:28 +01:00
deferred_executor.go modernize: Replace "interface{}" with "any". 2025-07-30 09:44:18 +02:00
deferred_executor_test.go Use "testing/synctest" to simplify timing-dependent tests. 2025-09-09 11:33:32 +02:00
dns_monitor.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
dns_monitor_test.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
etcd_client.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
etcd_client_test.go Add etcd TLS tests. 2025-09-29 23:46:36 +02:00
federation.go Fix race condition where closeOnLeave could be set after leave was received. 2025-11-04 15:46:19 +01:00
federation_test.go Fix race condition where closeOnLeave could be set after leave was received. 2025-11-04 15:46:19 +01:00
file_watcher.go Handle case where watched file is in a symlinked versioned subfolder. 2025-07-16 16:50:47 +02:00
file_watcher_test.go Handle case where watched file is in a symlinked versioned subfolder. 2025-07-16 16:50:47 +02:00
flags.go Use methods on atomic class instead of custom implementation. 2025-08-14 16:54:27 +02:00
flags_test.go Fix typo in error message on failed test condition. 2025-09-09 12:11:15 +02:00
geoip.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
geoip_test.go Modernize Go code and check from CI. 2025-08-14 09:23:25 +02:00
gnatsd.conf Initial commit of the OpenSource version. 2020-05-12 09:46:20 +02:00
go.mod Bump github.com/nats-io/nats-server/v2 from 2.12.0 to 2.12.1 2025-10-15 11:33:45 +00:00
go.sum Bump github.com/nats-io/nats-server/v2 from 2.12.0 to 2.12.1 2025-10-15 11:33:45 +00:00
grpc_backend.pb.go Update generated files from d4cdc059bf 2025-03-25 20:51:34 +00:00
grpc_backend.proto Implement per-backend session limit for clusters. 2022-07-13 11:52:20 +02:00
grpc_backend_grpc.pb.go Update generated files from f36ac95028 2024-07-31 09:07:16 +00:00
grpc_client.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
grpc_client_test.go Not allowed to run tests with mock dns lookup in parallel. 2025-08-18 09:52:48 +02:00
grpc_common.go Close file watcher on shutdown to prevent goroutine leaks. 2024-04-23 10:53:28 +02:00
grpc_common_test.go Add "localhost" to generated self-signed test certificates. 2025-09-29 23:46:22 +02:00
grpc_internal.pb.go Update generated files from d4cdc059bf 2025-03-25 20:51:34 +00:00
grpc_internal.proto Check version of cluster nodes and log warning if different. 2025-01-16 09:37:40 +01:00
grpc_internal_grpc.pb.go Update generated files from f36ac95028 2024-07-31 09:07:16 +00:00
grpc_mcu.pb.go Update generated files. 2025-07-24 09:22:47 +02:00
grpc_mcu.proto Return connection / publisher tokens for remote publishers. 2025-07-24 09:22:46 +02:00
grpc_mcu_grpc.pb.go Update generated files from f36ac95028 2024-07-31 09:07:16 +00:00
grpc_remote_client.go Add Context to clients / sessions. 2024-05-16 09:07:59 +02:00
grpc_server.go Add dedicated types for different session ids. 2025-09-09 11:38:47 +02:00
grpc_server_test.go Fix race condition in flaky certificate/CA reload tests. 2025-04-16 13:57:13 +02:00
grpc_sessions.pb.go Update generated files. 2025-07-17 14:36:31 +02:00
grpc_sessions.proto Prepare internal APIs for multiple backend urls. 2025-07-17 08:41:37 +02:00
grpc_sessions_grpc.pb.go Prevent duplicate virtual sessions in participant update events. 2024-10-30 11:59:28 +01:00
grpc_stats_prometheus.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
http_client_pool.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02: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 Switch to "github.com/stretchr/testify" for tests. 2024-09-03 13:50:52 +02:00
hub.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
hub_stats_prometheus.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
hub_test.go Don't use environment to keep per-test properties. 2025-11-04 16:11:35 +01:00
janus_client.go Expose real bandwidth usage through metrics. 2025-11-04 16:16:44 +01:00
LICENSE Initial commit of the OpenSource version. 2020-05-12 09:46:20 +02:00
lru.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
lru_test.go Make LruCache typed through generics. 2025-09-30 09:57:04 +02:00
Makefile Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
mcu_common.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
mcu_common_test.go Move "StringMap" class to api module. 2025-09-26 13:50:18 +02:00
mcu_janus.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
mcu_janus_client.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
mcu_janus_events_handler.go Add metrics for candidates and ICE, DTLS and PeerConnection states. 2025-11-06 20:41:53 +01:00
mcu_janus_events_handler_test.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
mcu_janus_publisher.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
mcu_janus_publisher_test.go Add test for remote publishers. 2025-10-01 16:39:25 +02:00
mcu_janus_remote_publisher.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
mcu_janus_remote_subscriber.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
mcu_janus_stream_selection.go Move "StringMap" class to api module. 2025-09-26 13:50:18 +02:00
mcu_janus_subscriber.go Add more subscriber tests. 2025-10-02 16:06:28 +02:00
mcu_janus_test.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
mcu_proxy.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
mcu_proxy_test.go Expose real bandwidth usage through metrics. 2025-11-04 16:16:44 +01:00
mcu_stats_prometheus.go Add metrics for candidates and ICE, DTLS and PeerConnection states. 2025-11-06 20:41:53 +01:00
mcu_test.go Switch to new Bandwidth type. 2025-11-06 10:57:24 +01:00
mkdocs.yml Add documentation on the available metrics. 2022-03-17 10:17:15 +01:00
mock_data_test.go Support filtering candidates received by clients. 2025-06-12 14:25:45 +02:00
natsclient.go modernize: Replace "interface{}" with "any". 2025-07-30 09:44:18 +02:00
natsclient_loopback.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
natsclient_loopback_test.go Switch to "github.com/stretchr/testify" for tests. 2024-09-03 13:50:52 +02:00
natsclient_test.go Modernize Go code and check from CI. 2025-08-14 09:23:25 +02:00
notifier.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
notifier_test.go Use "testing/synctest" to simplify timing-dependent tests. 2025-09-09 11:33:32 +02:00
proxy.conf.in Protect access to the debug pprof handlers. 2025-10-08 10:46:06 +02:00
proxy_config.go Use DNS monitor from static proxy configuration. 2024-01-30 17:03:43 +01:00
proxy_config_etcd.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
proxy_config_etcd_test.go Switch to "github.com/stretchr/testify" for tests. 2024-09-03 13:50:52 +02:00
proxy_config_static.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
proxy_config_static_test.go Switch to "github.com/stretchr/testify" for tests. 2024-09-03 13:50:52 +02:00
proxy_config_test.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
publisher_stats_counter.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
publisher_stats_counter_test.go Move Janus classes to separate files, no functional changes. 2024-05-21 09:29:17 +02:00
README.md Add note on how to configure Janus events. 2025-11-05 11:52:53 +01:00
remotesession.go Add dedicated types for different session ids. 2025-09-09 11:38:47 +02:00
room.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
room_ping.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
room_ping_test.go Test that backend URLs are containing the full OCS path. 2025-09-29 14:11:03 +02:00
room_stats_prometheus.go Add more metrics on rooms / sessions / backends. 2021-08-10 08:50:41 +02:00
room_test.go Add dedicated types for different session ids. 2025-09-09 11:38:47 +02:00
roomsessions.go Add dedicated types for different session ids. 2025-09-09 11:38:47 +02:00
roomsessions_builtin.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
roomsessions_builtin_test.go Switch to "github.com/stretchr/testify" for tests. 2024-09-03 13:50:52 +02:00
roomsessions_test.go Move "StringMap" class to api module. 2025-09-26 13:50:18 +02:00
server.conf.in Protect access to the debug pprof handlers. 2025-10-08 10:46:06 +02:00
session.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
session.pb.go Update generated files from d4cdc059bf 2025-03-25 20:51:34 +00:00
session.proto Encode session ids using protobufs. 2024-10-28 14:47:46 +01:00
session_test.go Test "HasAnyPermission" method. 2025-08-14 09:41:57 +02:00
sessionid_codec.go Add dedicated types for different session ids. 2025-09-09 11:38:47 +02:00
sessionid_codec_test.go Add dedicated types for different session ids. 2025-09-09 11:38:47 +02:00
single_notifier.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
single_notifier_test.go Use "testing/synctest" to simplify timing-dependent tests. 2025-09-09 11:33:32 +02:00
stats_prometheus.go Add prometheus metrics. 2021-08-10 08:50:39 +02:00
stats_prometheus_test.go Fix counting of backends for metrics. 2025-07-17 16:13:44 +02:00
synctest24_test.go Use "testing/synctest" to simplify timing-dependent tests. 2025-09-09 11:33:32 +02:00
synctest25_test.go Use "testing/synctest" to simplify timing-dependent tests. 2025-09-09 11:33:32 +02:00
syscallconn.go Explicitly use type "sysConn". 2023-02-07 09:04:35 +01:00
test_helpers.go test: Reset logging to global defaults on cleanup. 2024-05-14 16:52:46 +02:00
testclient_test.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
testutils_test.go Don't use environment to keep per-test properties. 2025-11-04 16:11:35 +01:00
throttle.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
throttle_stats_prometheus.go Add throttled requests to metrics. 2024-05-22 10:35:09 +02:00
throttle_test.go Use "testing/synctest" to simplify timing-dependent tests. 2025-09-09 11:33:32 +02:00
tools.go Simplify vendoring. 2023-06-07 17:26:32 +02:00
transient_data.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
transient_data_test.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00
vendor_helper_test.go Simplify vendoring. 2023-06-07 17:26:32 +02:00
virtualsession.go Move "StringMap" class to api module. 2025-09-26 13:50:18 +02:00
virtualsession_test.go Use gvisor checklocks for static lock analysis. 2025-10-01 13:49:32 +02:00

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.24
  • make

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

These additional tools are required to generate code from .proto files.

  • protobuf-compiler >= 3

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 images 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 on how to use and configure them.

To build the images locally, run the following commands (replace the parameter after -t with the name the image should be tagged as):

docker build -f docker/server/Dockerfile -t nextcloud-spreed-signaling .
docker build -f docker/proxy/Dockerfile -t nextcloud-spreed-signaling-proxy .

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, the websocket transport and the websocket events handler of Janus must be enabled. Also broadcasting of events 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.

To enable sending of events from Janus, the option broadcast must be set to true in the block events of janus.jcfg. In the configuration of the websocket events handler (janus.eventhandler.wsevh.jcfg), the module must be enabled by setting enabled to true, the backend must be set to the websocket url of the signaling server (or signaling proxy) and subprotocol must be set to janus-events. At least events of type media must be subscribed.

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.

Remote streams (preview)

With Janus 1.1.0 or newer, remote streams are supported, i.e. a subscriber can receive a published stream from any server. For this, you need to configure hostname, token_id and token_key in the proxy configuration. Each proxy server also supports configuring maximum incoming and outgoing bandwidth settings, which will also be used to select remote streams. See proxy.conf.in in section app for details.

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/"

    RequestHeader set X-Real-IP %{REMOTE_ADDR}s

    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
    header_up X-Real-IP {remote_host}
  }
}

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)