inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

집중하기 매우 어려움님의 게시글

집중하기 매우 어려움 집중하기 매우 어려움

@thelapssql3213

수강평 작성수
1
평균평점
5.0

게시글 6

질문&답변

socket.js 에서 referer로부터 roomId를 가져올 때

저도 질문자님처럼 request.referer가 undefined 뜨더라구요. 그래서 다음과 같이 작성하였어요. index.html 클라이언트에서 "roomId"를 Socket 연결 시 Url QueryString으로 전달 const socket = io.connect( `http://localhost:2000/chat?roomId=${$roomId}`, { path: "/socket.io", transports: ["websocket"], }, ); socket.ts interface IRequestQuery { roomId: string; } socket.on("disconnect", async () => { const { roomId }: IRequestQuery = socket.handshake .query as unknown as IRequestQuery; const currentRoom = chat.adapter.rooms.get(roomId); const userCount = currentRoom?.size; console.log(userCount); });

좋아요수
0
댓글수
3
조회수
931

고민있어요

느낌표살인마네

좋아요수
1
댓글수
1
조회수
352

질문&답변

TypeError: RateLimit is not a constructor

6이면 new 삭제하면 됩니다! https://www.npmjs.com/package/express-rate-limit

좋아요수
1
댓글수
2
조회수
818