inflearn logo
Khóa học

Khóa học

Chia sẻ kiến thức

Bài viết của thelapssql3213

thelapssql3213 thelapssql3213

@thelapssql3213

Số lượng đánh giá đã viết
1
Xếp hạng trung bình
5.0

Bài viết 3

Hỏi & Đáp

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); });

Lượt thích
0
Số bình luận
3
Lượt xem
933

Hỏi & Đáp

TypeError: RateLimit is not a constructor

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

Lượt thích
1
Số bình luận
2
Lượt xem
819