I'm trying to create chat with nestjs, and it is problem with its @SubscribeMessage(),
implementation with connection is working, but when I try to listen the emits from frontend and console the data in nestjs, it not works
import { Server, Socket } from 'socket.io';
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { User } from '../entities/user.entity';
import { Repository } from 'typeorm';
import { Messenger } from './entities/messenger.entity';
@Injectable()
@WebSocketGateway(5000)
export class MessengerGateway implements OnGatewayConnection, OnGatewayDisconnect, OnGatewayInit {
  constructor(
    @InjectRepository(User)
    private userRepository: Repository<User>,
    @InjectRepository(Messenger)
    private messageRepository: Repository<Messenger>,
  ) {}
  @SubscribeMessage('loadPeople')
  handleEvent(client: Socket, data){
    console.log(data);
    // this is not working
  }
  async afterInit(server: Server) {
    console.log('Init');
  }
  @SubscribeMessage('is-online')
  async handleConnection(client: Socket) {
    console.log('connected');
    // I can see this message in console
  }
  @SubscribeMessage('is-offline')
  async handleDisconnect(client: Socket) {
    console.log('disconnected');
     // I can see this message in console
  }
}
from front end I'm sending this requests
import { io } from "socket.io-client";
const  ENDPOINT = "localhost:5000";
let socket
function App(){
  useEffect(()=>{
          socket = io(ENDPOINT)
          socket.emit('loadPeople', {token: localStorage.token})
  },[])
  return (
  //...
  )
}
It works when I'm using the nodejs(expressjs) with socket.io, But when I try to do this with nestjs, it's not working