Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

99
Visualizações
socket joined the room but doesn't receive events in room

Socket joins a room on connection, the room name can be found on rooms set defined on socket itself, but when an event is fired to that room, it doesn't receive that. Can someone figure out the issue with my code?

Joining

    this.socketIOServer.on('connect', async (socket: AuthenticatedSocket) => {
      if (socket?.request?.user?.id) {
        await socket.join(socket.request.user.id);
        console.log(socket.rooms); // Set(2) { 'j462VueHBUxufBucAAAB', '62c16b98be39c3605f03fd5a' }
      }
    });

Emitting


    console.log(
      'Sockets',
      AppointmentsSocketService.server.sockets.sockets.forEach(s => {
        console.log(s.rooms); // Set(2) { 'j462VueHBUxufBucAAAB', '62c16b98be39c3605f03fd5a' } Found in output
      }),
    );

    /* EMIT EVENT TO ROOM */
    AppointmentsSocketService.server
      .to(appointment.patient.id) // id is exactly as room name '62c16b98be39c3605f03fd5a'
      .emit('appointments/status', appointment);

    console.log(
      'Sockets',
      AppointmentsSocketService.server.sockets.sockets.forEach(s => {
        console.log(s.rooms); // Set(2) { 'j462VueHBUxufBucAAAB', '62c16b98be39c3605f03fd5a' } Found in output
      }),
    );

I'm testing through postman, & that never receives the response. I also try using Firecamp app as well as wrote dummy script to test - but never received event.

Postman Screenshot

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda