Merge remote-tracking branch 'origin/master' into eric_front_and_back

This commit is contained in:
Me
2023-01-16 21:47:20 +01:00
6 changed files with 35 additions and 20 deletions

View File

@@ -1,3 +1,5 @@
import { HttpException, HttpStatus, Injectable, Res } from '@nestjs/common';
import { WsException } from '@nestjs/websockets';
import { WebSocketGateway, SubscribeMessage, WebSocketServer, MessageBody, ConnectedSocket, OnGatewayConnection, OnGatewayDisconnect } from '@nestjs/websockets';
import { UsersService } from 'src/users/users.service';
import { ChatService } from './chat.service';
@@ -22,12 +24,16 @@ implements OnGatewayConnection, OnGatewayDisconnect
@WebSocketServer()
server;
async handleConnection(socket: socketDto) {
async handleConnection(socket: socketDto)
{
printCaller('- socket connected :', socket.id, socket.handshake.query.username);
socket.username = socket.handshake.query.username.toString();
this.sockets.set(socket.username, socket);
if (!socket.username)
return;
this.sockets.set(socket.username, socket);
printCaller("--- socket.username:", socket.username);
let not_emit: string = `${socket.username}_not_emit`;