LINXD-2222: use https instead of httpolyglot; Added logs
This commit is contained in:
parent
a6681ffe40
commit
149876fc70
39
app.js
39
app.js
@ -9,13 +9,13 @@ const app = express();
|
|||||||
const Server = require('socket.io');
|
const Server = require('socket.io');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const httpolyglot = require('httpolyglot');
|
// const httpolyglot = require('httpolyglot');
|
||||||
// let https = require('https');
|
let https = require('https');
|
||||||
// try {
|
try {
|
||||||
// https = require('node:https');
|
https = require('node:https');
|
||||||
// } catch (err) {
|
} catch (err) {
|
||||||
// console.log('https support is disabled!');
|
console.log('https support is disabled!');
|
||||||
// }
|
}
|
||||||
|
|
||||||
const mediasoup = require('mediasoup');
|
const mediasoup = require('mediasoup');
|
||||||
|
|
||||||
@ -50,24 +50,29 @@ app.use('/sfu', express.static(path.join(__dirname, 'public')))
|
|||||||
const options = {
|
const options = {
|
||||||
key: fs.readFileSync('./server/ssl/key.pem', 'utf-8'),
|
key: fs.readFileSync('./server/ssl/key.pem', 'utf-8'),
|
||||||
cert: fs.readFileSync('./server/ssl/cert.pem', 'utf-8'),
|
cert: fs.readFileSync('./server/ssl/cert.pem', 'utf-8'),
|
||||||
|
requestCert: false,
|
||||||
|
rejectUnauthorized: false
|
||||||
}
|
}
|
||||||
|
|
||||||
// const httpsServer = https.createServer(options, app);
|
const httpsServer = https.createServer(options, app);
|
||||||
// const io = new Server(httpsServer, { allowEIO3: true });
|
// const io = new Server(httpsServer, { allowEIO3: true });
|
||||||
const httpsServer = httpolyglot.createServer(options, app);
|
// const httpsServer = httpolyglot.createServer(options, app);
|
||||||
|
|
||||||
|
|
||||||
|
const io = new Server(httpsServer, {
|
||||||
|
allowEIO3: true,
|
||||||
|
origins: ["*:*"],
|
||||||
|
allowRequest: (req, next) => {
|
||||||
|
console.log('req', req);
|
||||||
|
next(null, true)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// const io = new Server(server, { origins: '*:*', allowEIO3: true });
|
||||||
|
|
||||||
httpsServer.listen(process.env.PORT, () => {
|
httpsServer.listen(process.env.PORT, () => {
|
||||||
console.log('Listening on port:', process.env.PORT)
|
console.log('Listening on port:', process.env.PORT)
|
||||||
})
|
})
|
||||||
|
|
||||||
const io = new Server(httpsServer, {
|
|
||||||
allowRequest: (req) => {
|
|
||||||
console.log('req', req);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// const io = new Server(server, { origins: '*:*', allowEIO3: true });
|
|
||||||
|
|
||||||
// io.use(middleware);
|
// io.use(middleware);
|
||||||
// const httpsServer = https.createServer(options, app)
|
// const httpsServer = https.createServer(options, app)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user