Skip to content

Using with HTTPS #71

Answered by TannerGabriel
LimitedGlove asked this question in Q&A
Discussion options

You must be logged in to vote

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 ws to wss for the broadcast and watcher. If establishing the peer connection fails, consider adding a Turn server.

Another option for the certificate would be …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TannerGabriel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants