gros probleme resolu

This commit is contained in:
simplonco
2023-01-16 21:06:58 +01:00
parent 8b365968ac
commit cf05d242cd
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`;