LINXD-2222-debugging-for-i-os #7
40
app.js
40
app.js
@ -3,36 +3,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const app = express();
|
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');
|
||||||
let 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');
|
||||||
/* 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
|
let worker
|
||||||
/**
|
/**
|
||||||
@ -71,9 +55,9 @@ const options = {
|
|||||||
// const io = new Server(httpsServer, { allowEIO3: true });
|
// const io = new Server(httpsServer, { allowEIO3: true });
|
||||||
const httpsServer = https.createServer(options, app);
|
const httpsServer = https.createServer(options, app);
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
httpsServer.listen(process.env.PORT, () => {
|
||||||
res.send('Now using https..');
|
console.log('Listening on port:', process.env.PORT)
|
||||||
});
|
})
|
||||||
|
|
||||||
const io = new Server(httpsServer, {
|
const io = new Server(httpsServer, {
|
||||||
allowRequest: (req) => {
|
allowRequest: (req) => {
|
||||||
@ -86,10 +70,6 @@ const io = new Server(httpsServer, {
|
|||||||
// io.use(middleware);
|
// io.use(middleware);
|
||||||
// const httpsServer = https.createServer(options, app)
|
// const httpsServer = https.createServer(options, app)
|
||||||
|
|
||||||
httpsServer.listen(process.env.PORT, () => {
|
|
||||||
console.log('Listening on port:', process.env.PORT)
|
|
||||||
})
|
|
||||||
|
|
||||||
// const io = new Server(httpsServer, {
|
// const io = new Server(httpsServer, {
|
||||||
// allowEIO3: true
|
// allowEIO3: true
|
||||||
// });
|
// });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user