PeerJS Server connecting SSL

1.1k views Asked by At

I started my own PeerJS server, everything works, but now I don't know how to connect an ssl certificate to it. The documentation says:

Simply pass in PEM-encoded certificate and key.

const fs = require('fs');
const { PeerServer } = require('peer');

const peerServer = PeerServer({
  port: 9000,
  ssl: {
    key: fs.readFileSync('/path/to/your/ssl/key/here.key'),
    cert: fs.readFileSync('/path/to/your/ssl/certificate/here.crt')
  }
});

and where to insert this code, where this file is located? please explain who knows...

1

There are 1 answers

1
Rex Anthony On

This code should be added to the server.js file