This commit is contained in:
virus
2025-01-29 10:14:29 +01:00
parent 69d8ca94e7
commit 2528faf7ed
4 changed files with 22 additions and 14 deletions
+12 -1
View File
@@ -1,11 +1,22 @@
const PORT = process.env.PORT || 8080;
const PREFIX = process.env.PREFIX || '/ws';
const DEV = process.env.DEV || false;
console.log('Socket.io listen on: http://localhost:' + PORT + '' + PREFIX + '/socket.io');
console.log('Publisher listen on: http://localhost:' + PORT + '' + PREFIX + '/pub/$roomID');
if (DEV !== false) {
console.log('System is on DEV mode');
}
const app = require('express')();
const server = require('http').createServer(app);
const io = require('socket.io')(server, {path: PREFIX + '/socket.io'});
var io;
if (DEV !== false) {
io = require('socket.io')(server, {path: PREFIX + '/socket.io', cors: {origin: '*',}});
} else {
io = require('socket.io')(server, {path: PREFIX + '/socket.io'});
}
const bodyParser = require('body-parser');