LINXD-2222: Set namespate to '/'; Removed httpolyglot; Removed unused code

This commit is contained in:
Sergiu Toma 2022-09-20 14:02:22 +03:00
parent 149876fc70
commit be396e1047
3 changed files with 6 additions and 38 deletions

29
app.js
View File

@ -1,7 +1,3 @@
/**
* integrating mediasoup server with a node.js application
*/
require('dotenv').config() require('dotenv').config()
const express = require('express'); const express = require('express');
@ -9,14 +5,12 @@ 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');
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');
let worker let worker
@ -55,33 +49,22 @@ const options = {
} }
const httpsServer = https.createServer(options, app); const httpsServer = https.createServer(options, app);
// const io = new Server(httpsServer, { allowEIO3: true });
// const httpsServer = httpolyglot.createServer(options, app);
const io = new Server(httpsServer, { const io = new Server(httpsServer, {
allowEIO3: true, allowEIO3: true,
origins: ["*:*"], origins: ["*:*"],
allowRequest: (req, next) => { // allowRequest: (req, next) => {
console.log('req', req); // console.log('req', req);
next(null, true) // next(null, true)
} // }
}); });
// const io = new Server(server, { origins: '*:*', allowEIO3: 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('Video server listening on port:', process.env.PORT)
}) })
// io.use(middleware); const peers = io.of('/')
// const httpsServer = https.createServer(options, app)
// const io = new Server(httpsServer, {
// allowEIO3: true
// });
// socket.io namespace (could represent a room?)
const peers = io.of('/mediasoup')
const createWorker = async () => { const createWorker = async () => {
worker = await mediasoup.createWorker({ worker = await mediasoup.createWorker({

14
package-lock.json generated
View File

@ -12,7 +12,6 @@
"@types/express": "^4.17.13", "@types/express": "^4.17.13",
"dotenv": "^16.0.1", "dotenv": "^16.0.1",
"express": "^4.18.1", "express": "^4.18.1",
"httpolyglot": "^0.1.2",
"mediasoup": "^3.10.4", "mediasoup": "^3.10.4",
"mediasoup-client": "^3.6.54", "mediasoup-client": "^3.6.54",
"parcel": "^2.7.0", "parcel": "^2.7.0",
@ -4604,14 +4603,6 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true "dev": true
}, },
"node_modules/httpolyglot": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/httpolyglot/-/httpolyglot-0.1.2.tgz",
"integrity": "sha512-ouHI1AaQMLgn4L224527S5+vq6hgvqPteurVfbm7ChViM3He2Wa8KP1Ny7pTYd7QKnDSPKcN8JYfC8r/lmsE3A==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/https-browserify": { "node_modules/https-browserify": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz",
@ -11564,11 +11555,6 @@
} }
} }
}, },
"httpolyglot": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/httpolyglot/-/httpolyglot-0.1.2.tgz",
"integrity": "sha512-ouHI1AaQMLgn4L224527S5+vq6hgvqPteurVfbm7ChViM3He2Wa8KP1Ny7pTYd7QKnDSPKcN8JYfC8r/lmsE3A=="
},
"https-browserify": { "https-browserify": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz",

View File

@ -16,7 +16,6 @@
"@types/express": "^4.17.13", "@types/express": "^4.17.13",
"dotenv": "^16.0.1", "dotenv": "^16.0.1",
"express": "^4.18.1", "express": "^4.18.1",
"httpolyglot": "^0.1.2",
"mediasoup": "^3.10.4", "mediasoup": "^3.10.4",
"mediasoup-client": "^3.6.54", "mediasoup-client": "^3.6.54",
"parcel": "^2.7.0", "parcel": "^2.7.0",