increase logging (#7)
This commit is contained in:
parent
8ccd9d91f9
commit
4cdf41a899
3 changed files with 7 additions and 5 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
dist
|
dist
|
||||||
node_modules
|
node_modules
|
||||||
|
deploy.sh
|
|
@ -32,6 +32,7 @@
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"lint-fix": "eslint . --fix",
|
"lint-fix": "eslint . --fix",
|
||||||
"start": "tsc && node dist/index.js",
|
"start": "tsc && node dist/index.js",
|
||||||
|
"start:local": "tsc && DEBUG='engine,app,socket.io:client,server' node dist/index.js",
|
||||||
"start:dev": "cross-env NODE_ENV=development ts-node-dev --respawn --transpile-only src/index.ts"
|
"start:dev": "cross-env NODE_ENV=development ts-node-dev --respawn --transpile-only src/index.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -47,10 +47,10 @@ prometheus.metrics(io, {
|
||||||
});
|
});
|
||||||
|
|
||||||
io.on('connection', socket => {
|
io.on('connection', socket => {
|
||||||
ioDebug('connection established!');
|
serverDebug(`connection established! ${socket.conn.request.url}`);
|
||||||
io.to(`${socket.id}`).emit('init-room');
|
io.to(`${socket.id}`).emit('init-room');
|
||||||
socket.on('join-room', roomID => {
|
socket.on('join-room', roomID => {
|
||||||
socketDebug(`${socket.id} has joined ${roomID}`);
|
serverDebug(`${socket.id} has joined ${roomID} for url ${socket.conn.request.url}`);
|
||||||
socket.join(roomID);
|
socket.join(roomID);
|
||||||
if (io.sockets.adapter.rooms[roomID].length <= 1) {
|
if (io.sockets.adapter.rooms[roomID].length <= 1) {
|
||||||
io.to(`${socket.id}`).emit('first-in-room');
|
io.to(`${socket.id}`).emit('first-in-room');
|
||||||
|
@ -66,7 +66,7 @@ io.on('connection', socket => {
|
||||||
socket.on(
|
socket.on(
|
||||||
'server-broadcast',
|
'server-broadcast',
|
||||||
(roomID: string, encryptedData: ArrayBuffer, iv: Uint8Array) => {
|
(roomID: string, encryptedData: ArrayBuffer, iv: Uint8Array) => {
|
||||||
socketDebug(`${socket.id} sends update to ${roomID}`);
|
serverDebug(`${socket.id} sends update to ${roomID}`);
|
||||||
socket.broadcast.to(roomID).emit('client-broadcast', encryptedData, iv);
|
socket.broadcast.to(roomID).emit('client-broadcast', encryptedData, iv);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -74,7 +74,7 @@ io.on('connection', socket => {
|
||||||
socket.on(
|
socket.on(
|
||||||
'server-volatile-broadcast',
|
'server-volatile-broadcast',
|
||||||
(roomID: string, encryptedData: ArrayBuffer, iv: Uint8Array) => {
|
(roomID: string, encryptedData: ArrayBuffer, iv: Uint8Array) => {
|
||||||
socketDebug(`${socket.id} sends volatile update to ${roomID}`);
|
serverDebug(`${socket.id} sends volatile update to ${roomID}`);
|
||||||
socket.volatile.broadcast
|
socket.volatile.broadcast
|
||||||
.to(roomID)
|
.to(roomID)
|
||||||
.emit('client-broadcast', encryptedData, iv);
|
.emit('client-broadcast', encryptedData, iv);
|
||||||
|
|
Loading…
Reference in a new issue