This commit is contained in:
陆柯 2023-10-04 21:14:04 +08:00
parent c81ae8bc42
commit e0e2c154b6

View File

@ -13,7 +13,7 @@ module.exports = {
console.info('Base Socket Server is initialized.') console.info('Base Socket Server is initialized.')
my.wsServer.on('connection', (socket, req) => { my.wsServer.on('connection', (socket, req) => {
console.info(`A socket is connecting from ${req.connection.remoteAddress}:${req.connection.remotePort}.`) //console.info(`A socket is connecting from ${req.connection.remoteAddress}:${req.connection.remotePort}.`)
// socket.isAlive = true // socket.isAlive = true
// socket.on('pong', function() { console.log('👈 ASS: on Pong'); this.isAlive = true }) // socket.on('pong', function() { console.log('👈 ASS: on Pong'); this.isAlive = true })
@ -60,7 +60,7 @@ module.exports = {
// }, 60000) // }, 60000)
socket.on('close', () => { socket.on('close', () => {
console.log('Closing socket of usid =', socket?.usid) //console.log('Closing socket of usid =', socket?.usid) // don't know why, but this output happens too often without usid.
delete my.socketPool[socket?.usid] delete my.socketPool[socket?.usid]
// clearInterval(heartbeat) // clearInterval(heartbeat)
}) })