• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

socketIO room 관련 질문

22.06.03 00:56 작성 조회수 178

0

      io.of(`/ws-${workspace.url}`)
        .to(`/ws-${workspace.url}-${channel.id}`)
        .emit("message", chatWithUser);
      this.eventsGateway.server
        // .of(`/ws-${url}`)
        .to(`/ws-${url}-${chatWithUser.ChannelId}`)
        .emit('message', chatWithUser);
    }

깃허브를 참조해서 위 둘이 같은 코드라는 것은 알겠는데,

io.of(namespace).to(room).emit(~);

의 형태이니까,

예를들어 제가 typescript 워크스페이스에 error 채널에서 채팅을 한다고 하면

namespace는 ws-typescript이고, room은 ws-typescript-error인건가요...?

그리고 of는 왜 주석처리가 되어있는 건가요? event-gateway에서 namespace를 이미 처리해서 그렇게 된건가요?

 

 

 

답변 1

답변을 작성해보세요.

0

channel.id라서 ws-typescript-123 이렇게 됩니다.

eventGateway에서 처리해서 그렇습니다.