From 9c731f4085cdcc3ce75d617575cb482803334431 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 19 Sep 2022 17:03:58 +0300 Subject: [PATCH] LINXD-2222: Update --- app.js | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/app.js b/app.js index 8b9e407..7be1a73 100644 --- a/app.js +++ b/app.js @@ -8,14 +8,19 @@ import 'dotenv/config' /* https://mediasoup.org/documentation/v3/mediasoup/installation/ */ import express from 'express' const app = express() - -import https from 'httpolyglot' +// const app = require('express')(); +// import https from 'httpolyglot' +import * as https from "http"; import fs from 'fs' import path from 'path' const __dirname = path.resolve() -import Server from 'socket.io' +// 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 /** @@ -50,15 +55,20 @@ const options = { cert: fs.readFileSync('./server/ssl/cert.pem', 'utf-8') } -const httpsServer = https.createServer(options, app) +const httpsServer = https.createServer(options, app); +const io = new Server(httpsServer, { allowEIO3: true }); +// const io = new Server(server, { origins: '*:*', allowEIO3: true }); -httpsServer.listen(process.env.PORT, () => { - console.log('Listening on port:', process.env.PORT) -}) +// io.use(middleware); +// const httpsServer = https.createServer(options, app) -const io = new Server(httpsServer, { - allowEIO3: true -}); +// httpsServer.listen(process.env.PORT, () => { +// console.log('Listening on port:', process.env.PORT) +// }) + +// const io = new Server(httpsServer, { +// allowEIO3: true +// }); // socket.io namespace (could represent a room?) const peers = io.of('/mediasoup')