(clientId: Id, clients: IdMap<WebSocket>, serverClient: ServerClient)
| 171 | |
| 172 | const getMessageHandler = |
| 173 | (clientId: Id, clients: IdMap<WebSocket>, serverClient: ServerClient) => |
| 174 | (payload: string) => |
| 175 | ifPayloadValid(payload, (toClientId, remainder) => { |
| 176 | const forwardedPayload = createRawPayload(clientId, remainder); |
| 177 | if (toClientId === EMPTY_STRING) { |
| 178 | if (clientId !== SERVER_CLIENT_ID) { |
| 179 | serverClient[Sc.Send]?.(forwardedPayload); |
| 180 | } |
| 181 | mapForEach(clients, (otherClientId, otherClient) => |
| 182 | otherClientId !== clientId ? otherClient.send(forwardedPayload) : 0, |
| 183 | ); |
| 184 | } else if (toClientId === SERVER_CLIENT_ID) { |
| 185 | serverClient[Sc.Send]?.(forwardedPayload); |
| 186 | } else { |
| 187 | mapGet(clients, toClientId)?.send(forwardedPayload); |
| 188 | } |
| 189 | }); |
| 190 | |
| 191 | webSocketServer.on('connection', (client, request) => |
| 192 | ifNotUndefined(strMatch(request.url, PATH_REGEX), ([, pathId]) => |
no test coverage detected
searching dependent graphs…