Browse Source

nest socket disconnect

master
Pheuw1 2 years ago
parent
commit
f8226dde22
  1. 6
      back/volume/src/chat/chat.gateway.ts

6
back/volume/src/chat/chat.gateway.ts

@ -37,11 +37,7 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect {
async handleConnection (socket: Socket): Promise<void> {} async handleConnection (socket: Socket): Promise<void> {}
async handleDisconnect (socket: Socket): Promise<void> { async handleDisconnect (socket: Socket): Promise<void> {
const user = await this.connectedUserRepository.findOneBy({ await this.onLeaveChannel(socket)
socket: socket.id
})
if (user !== null) await this.connectedUserRepository.remove(user)
socket.disconnect()
} }
@SubscribeMessage('joinChannel') @SubscribeMessage('joinChannel')

Loading…
Cancel
Save