Skip to content

Commit d6b0f69

Browse files
committed
feat: 웹소켓 디버깅 모듈 추가
각 네임스페이스마다 어떤 웹소켓이 있는지 알려주는 함수 추가
1 parent 8ddde7b commit d6b0f69

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

server/debug/websocket-analyzer.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Server } from 'socket.io';
2+
3+
export function getSocketsForNamespaces(io: Server) {
4+
const _nsps = io._nsps;
5+
6+
const namespaces = Array.from(_nsps.keys());
7+
const socketsForNamespaces = namespaces.map((namespace) => {
8+
return { [namespace]: Array.from(_nsps.get(namespace).sockets.keys()) };
9+
});
10+
11+
return socketsForNamespaces;
12+
}

0 commit comments

Comments
 (0)