Compare commits

...

7 Commits

Author SHA1 Message Date
Sergiu Toma 2e336a429e fix 2022-10-18 18:23:54 +03:00
Sergiu Toma b14e82fd87 fix 2022-10-18 18:22:19 +03:00
Sergiu Toma c4f72eddd5 fix 2022-10-18 18:21:07 +03:00
Sergiu Toma 6e4ceb9977 fixes 2022-10-18 18:18:29 +03:00
Sergiu Toma 2c00de1dd0 fix ssl cert/key 2022-10-18 18:13:24 +03:00
Sergiu Toma f96fd24e03 Fix https 2022-10-18 18:12:03 +03:00
Sergiu Toma fce2f30648 Fix https import 2022-10-18 18:07:04 +03:00
1 changed files with 5 additions and 9 deletions

14
app.js
View File

@ -5,12 +5,7 @@ const app = express();
const Server = require('socket.io');
const path = require('node:path');
const fs = require('node:fs');
let https;
try {
https = require('node:https');
} catch (err) {
console.log('https support is disabled!');
}
const https = require('https');
const mediasoup = require('mediasoup');
let worker
@ -42,8 +37,8 @@ app.use('/sfu', express.static(path.join(__dirname, 'public')))
// SSL cert for HTTPS access
const options = {
key: fs.readFileSync(process.env.SERVER_KEY, 'utf-8'),
cert: fs.readFileSync(process.env.SERVER_CERT, 'utf-8'),
key: fs.readFileSync('./server/ssl/key.pem', 'utf-8'),
cert: fs.readFileSync('./server/ssl/cert.pem', 'utf-8'),
}
const httpsServer = https.createServer(options, app);
@ -63,7 +58,8 @@ httpsServer.listen(process.env.PORT, () => {
});
const peers = io.of('/');
console.log('process.env.RTC_MIN_PORT', process.env.RTC_MIN_PORT);
console.log('process.env.RTC_MAX_PORT', process.env.RTC_MAX_PORT, process.env.RTC_MAX_PORT.length);
const createWorker = async () => {
try {
worker = await mediasoup.createWorker({