LINXD-2222: Update

This commit is contained in:
Sergiu Toma 2022-09-19 23:09:55 +03:00
parent 0ec5769ee0
commit ae39a45f6d
1 changed files with 10 additions and 30 deletions

40
app.js
View File

@ -3,36 +3,20 @@
*/
require('dotenv').config()
const express = require('express');
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!');
}
let https = require('https');;
// try {
// https = require('node:https');
// } catch (err) {
// console.log('https support is disabled!');
// }
const mediasoup = require('mediasoup');
/* Please follow mediasoup installation requirements */
/* https://mediasoup.org/documentation/v3/mediasoup/installation/ */
// import express from 'express'
// const app = express()
// const app = require('express')();
// import https from 'httpolyglot'
// import https from "https";
// import fs from 'fs'
// import path from 'path'
// import Server from 'socket.io'
// import mediasoup from 'mediasoup'
// import * as https from "http";
// import Server from "socket.io";
// import middleware from 'socketio-wildcard'
// const app = express.default();
let worker
/**
@ -71,9 +55,9 @@ const options = {
// const io = new Server(httpsServer, { allowEIO3: true });
const httpsServer = https.createServer(options, app);
app.get('/', (req, res) => {
res.send('Now using https..');
});
httpsServer.listen(process.env.PORT, () => {
console.log('Listening on port:', process.env.PORT)
})
const io = new Server(httpsServer, {
allowRequest: (req) => {
@ -86,10 +70,6 @@ const io = new Server(httpsServer, {
// io.use(middleware);
// const httpsServer = https.createServer(options, app)
httpsServer.listen(process.env.PORT, () => {
console.log('Listening on port:', process.env.PORT)
})
// const io = new Server(httpsServer, {
// allowEIO3: true
// });