MCPcopy Index your code
hub / github.com/ether/etherpad / _getRoomSockets

Function _getRoomSockets

src/node/handler/PadMessageHandler.ts:1686–1698  ·  view source on GitHub ↗
(padID: string)

Source from the content-addressed store, hash-verified

1684};
1685
1686const _getRoomSockets = (padID: string) => {
1687 const ns = socketio.sockets; // Default namespace.
1688 // We could call adapter.clients(), but that method is unnecessarily asynchronous. Replicate what
1689 // it does here, but synchronously to avoid a race condition. This code will have to change when
1690 // we update to socket.io v3.
1691 const room = ns.adapter.rooms?.get(padID);
1692
1693 if (!room) return [];
1694
1695 return Array.from(room)
1696 .map(socketId => ns.sockets.get(socketId))
1697 .filter(socket => socket);
1698};
1699
1700/**
1701 * Get the number of users in a pad

Callers 4

handlePadOptionsMessageFunction · 0.85
handleSuggestUserNameFunction · 0.85
handleClientReadyFunction · 0.85

Calls 2

getMethod · 0.80
mapMethod · 0.80

Tested by

no test coverage detected