wsid cannot be undefined
All checks were successful
Build / build (pull_request) Successful in 1m38s

This commit is contained in:
Sainan 2025-07-17 14:07:21 +02:00
parent 492a53093b
commit 64ebcad7fc

View File

@ -43,7 +43,7 @@ export const stopWsServers = (promises: Promise<void>[]): void => {
let lastWsid: number = 0; let lastWsid: number = 0;
interface IWsCustomData extends ws { interface IWsCustomData extends ws {
id?: number; id: number;
accountId?: string; accountId?: string;
} }
@ -187,7 +187,7 @@ export const sendWsBroadcastEx = (data: IWsMsgToClient, accountId?: string, excl
for (const client of wsServer.clients) { for (const client of wsServer.clients) {
if ( if (
(!accountId || (client as IWsCustomData).accountId == accountId) && (!accountId || (client as IWsCustomData).accountId == accountId) &&
(!excludeWsid || (client as IWsCustomData).id != excludeWsid) (client as IWsCustomData).id != excludeWsid
) { ) {
client.send(msg); client.send(msg);
} }
@ -197,7 +197,7 @@ export const sendWsBroadcastEx = (data: IWsMsgToClient, accountId?: string, excl
for (const client of wssServer.clients) { for (const client of wssServer.clients) {
if ( if (
(!accountId || (client as IWsCustomData).accountId == accountId) && (!accountId || (client as IWsCustomData).accountId == accountId) &&
(!excludeWsid || (client as IWsCustomData).id != excludeWsid) (client as IWsCustomData).id != excludeWsid
) { ) {
client.send(msg); client.send(msg);
} }