LINXD-2222: Update

This commit is contained in:
Sergiu Toma 2022-09-19 17:40:57 +03:00
parent a59cbcf8cc
commit 40c03592df
2 changed files with 25 additions and 13 deletions

37
app.js
View File

@ -1,24 +1,35 @@
import 'dotenv/config'
/**
* integrating mediasoup server with a node.js application
*/
require('dotenv').config()
const app = require('express')();
const https = require('https');
const path = require('node:path');
const __dirname = path.resolve()
let 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()
// 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'
const __dirname = path.resolve()
// import https from "https";
// import fs from 'fs'
// import path from 'path'
// import Server from 'socket.io'
import mediasoup from 'mediasoup'
// import mediasoup from 'mediasoup'
// import * as https from "http";
import Server from "socket.io";
// import Server from "socket.io";
// import middleware from 'socketio-wildcard'
// const app = express.default();
@ -55,8 +66,10 @@ const options = {
cert: fs.readFileSync('./server/ssl/cert.pem', 'utf-8')
}
const httpsServer = https.createServer(options, app);
const io = new Server(httpsServer, { allowEIO3: true });
// const httpsServer = https.createServer(options, app);
// const io = new Server(httpsServer, { allowEIO3: true });
const server = https.createServer(app);
const io = require('socket.io')(server, options);
// const io = new Server(server, { origins: '*:*', allowEIO3: true });
// io.use(middleware);

View File

@ -12,7 +12,6 @@
"keywords": [],
"author": "",
"license": "ISC",
"type": "module",
"dependencies": {
"@types/express": "^4.17.13",
"dotenv": "^16.0.1",