LINXD-2222-debugging-for-i-os #7
34
app.js
34
app.js
@ -6,16 +6,22 @@ import 'dotenv/config'
|
|||||||
|
|
||||||
/* Please follow mediasoup installation requirements */
|
/* Please follow mediasoup installation requirements */
|
||||||
/* https://mediasoup.org/documentation/v3/mediasoup/installation/ */
|
/* https://mediasoup.org/documentation/v3/mediasoup/installation/ */
|
||||||
import express from 'express'
|
// import express from 'express'
|
||||||
const app = express()
|
// const app = express()
|
||||||
|
// const app = require('express')();
|
||||||
import https from 'httpolyglot'
|
// import https from 'httpolyglot'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
const __dirname = path.resolve()
|
const __dirname = path.resolve()
|
||||||
|
|
||||||
import Server from 'socket.io'
|
// import Server from 'socket.io'
|
||||||
import mediasoup from 'mediasoup'
|
import mediasoup from 'mediasoup'
|
||||||
|
import * as express from "express";
|
||||||
|
import * as https from "http";
|
||||||
|
import Server from "socket.io";
|
||||||
|
import middleware from 'socketio-wildcard'
|
||||||
|
var middleware = require('socketio-wildcard')();
|
||||||
|
const app = express.default();
|
||||||
|
|
||||||
let worker
|
let worker
|
||||||
/**
|
/**
|
||||||
@ -50,15 +56,19 @@ const options = {
|
|||||||
cert: fs.readFileSync('./server/ssl/cert.pem', 'utf-8')
|
cert: fs.readFileSync('./server/ssl/cert.pem', 'utf-8')
|
||||||
}
|
}
|
||||||
|
|
||||||
const httpsServer = https.createServer(options, app)
|
const server = https.createServer(options, app);
|
||||||
|
const io = new Server(server, { origins: '*:*', allowEIO3: true });
|
||||||
|
|
||||||
httpsServer.listen(process.env.PORT, () => {
|
io.use(middleware);
|
||||||
console.log('Listening on port:', process.env.PORT)
|
// const httpsServer = https.createServer(options, app)
|
||||||
})
|
|
||||||
|
|
||||||
const io = new Server(httpsServer, {
|
// httpsServer.listen(process.env.PORT, () => {
|
||||||
allowEIO3: true
|
// console.log('Listening on port:', process.env.PORT)
|
||||||
});
|
// })
|
||||||
|
|
||||||
|
// const io = new Server(httpsServer, {
|
||||||
|
// allowEIO3: true
|
||||||
|
// });
|
||||||
|
|
||||||
// socket.io namespace (could represent a room?)
|
// socket.io namespace (could represent a room?)
|
||||||
const peers = io.of('/mediasoup')
|
const peers = io.of('/mediasoup')
|
||||||
|
13
package-lock.json
generated
13
package-lock.json
generated
@ -17,7 +17,8 @@
|
|||||||
"mediasoup-client": "^3.6.54",
|
"mediasoup-client": "^3.6.54",
|
||||||
"parcel": "^2.7.0",
|
"parcel": "^2.7.0",
|
||||||
"socket.io": "^2.0.3",
|
"socket.io": "^2.0.3",
|
||||||
"socket.io-client": "^2.0.3"
|
"socket.io-client": "^2.0.3",
|
||||||
|
"socketio-wildcard": "^2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^2.0.19",
|
"nodemon": "^2.0.19",
|
||||||
@ -7117,6 +7118,11 @@
|
|||||||
"ms": "2.0.0"
|
"ms": "2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/socketio-wildcard": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/socketio-wildcard/-/socketio-wildcard-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-Bf3ioZq15Z2yhFLDasRvbYitg82rwm+5AuER5kQvEQHhNFf4R4K5o/h57nEpN7A59T9FyRtTj34HZfMWAruw/A=="
|
||||||
|
},
|
||||||
"node_modules/socks": {
|
"node_modules/socks": {
|
||||||
"version": "2.7.0",
|
"version": "2.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz",
|
||||||
@ -13522,6 +13528,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"socketio-wildcard": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/socketio-wildcard/-/socketio-wildcard-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-Bf3ioZq15Z2yhFLDasRvbYitg82rwm+5AuER5kQvEQHhNFf4R4K5o/h57nEpN7A59T9FyRtTj34HZfMWAruw/A=="
|
||||||
|
},
|
||||||
"socks": {
|
"socks": {
|
||||||
"version": "2.7.0",
|
"version": "2.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz",
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
"mediasoup-client": "^3.6.54",
|
"mediasoup-client": "^3.6.54",
|
||||||
"parcel": "^2.7.0",
|
"parcel": "^2.7.0",
|
||||||
"socket.io": "^2.0.3",
|
"socket.io": "^2.0.3",
|
||||||
"socket.io-client": "^2.0.3"
|
"socket.io-client": "^2.0.3",
|
||||||
|
"socketio-wildcard": "^2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^2.0.19",
|
"nodemon": "^2.0.19",
|
||||||
|
Loading…
Reference in New Issue
Block a user