Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
"express": "^4.17.1",
"morgan": "^1.10.0",
"node-turn": "0.0.6",
"pug": "^3.0.0",
"socket.io": "^2.3.0",
"pug": "^3.0.2",
"socket.io": "^3.1.2",
"tracer": "^1.1.4",
"yaml": "^1.10.0"
"yaml": "^1.10.2"
},
"scripts": {
"start": "yarn compile && node dist/index.js",
"compile": "tsc",
"heroku-postbuild": "yarn compile"
},
"devDependencies": {
"@types/express": "^4.17.8",
"@types/express": "^4.17.11",
"@types/morgan": "^1.9.2",
"@types/socket.io": "^2.1.11",
"typescript": "^4.0.5"
"@types/socket.io": "^2.1.13",
"typescript": "^4.2.3"
}
}
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Server } from 'http';
import { Server as HttpsServer } from 'https';
import { readFileSync } from 'fs';
import { join } from 'path';
import socketIO from 'socket.io';
import { Server as IOServer, Socket } from "socket.io";
import Tracer from 'tracer';
import morgan from 'morgan';
import crypto from 'crypto';
Expand Down Expand Up @@ -62,7 +62,7 @@ if (peerConfig.integratedRelay.enabled) {
turnServer.start();
}

const io = socketIO(server);
const io = new IOServer(server);

const clients = new Map<string, Client>();

Expand Down Expand Up @@ -109,7 +109,7 @@ app.get('/health', (req, res) => {



io.on('connection', (socket: socketIO.Socket) => {
io.on('connection', (socket: Socket) => {
connectionCount++;
logger.info('Total connected: %d', connectionCount);
let code: string | null = null;
Expand Down Expand Up @@ -140,8 +140,8 @@ io.on('connection', (socket: socketIO.Socket) => {
}

let otherClients: any = {};
if (io.sockets.adapter.rooms[c]) {
let socketsInLobby = Object.keys(io.sockets.adapter.rooms[c].sockets);
if (io.sockets.adapter.rooms.get(c)) {
let socketsInLobby = Object.keys(io.sockets.adapter.rooms.get(c));
for (let s of socketsInLobby) {
// if (clients.has(s) && clients.get(s).clientId === clientId) {
// socket.disconnect();
Expand Down
Loading