Using with HTTPS #71
-
Is there a way to enable https? I am trying to set this up on a VPS so I can have a livestream on my website. Everything works great locally, but when I try to access the pages from the VPS on port 4000 I get an SSL Protocol Error. I can access the pages on port 443, but the JavaScript doesn't work. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The repo does not include a configuration for HTTPS, so you would need to add it yourself. You will need a certificate and a secure WebSockets connection. Something like: const express = require("express");
const app = express();
const fs = require('fs');
const https = require('https');
// SSL certificate
const options = {
key: fs.readFileSync('path/to/privatekey.key'),
cert: fs.readFileSync('path/to/certificate.crt')
};
let broadcaster;
const port = 4000;
const server = https.createServer(options, app); And then change from Another option for the certificate would be using the Nginx LetsEncrypt companion in Docker. |
Beta Was this translation helpful? Give feedback.
The repo does not include a configuration for HTTPS, so you would need to add it yourself. You will need a certificate and a secure WebSockets connection. Something like:
And then change from
ws
towss
for thebroadcast
andwatcher
. If establishing the peer connection fails, consider adding a Turn server.Another option for the certificate would be …