diff --git a/ui-ngx/src/app/core/ws/telemetry-websocket.service.ts b/ui-ngx/src/app/core/ws/telemetry-websocket.service.ts index 2d7c8af529..fbe69d55ae 100644 --- a/ui-ngx/src/app/core/ws/telemetry-websocket.service.ts +++ b/ui-ngx/src/app/core/ws/telemetry-websocket.service.ts @@ -81,6 +81,12 @@ export class TelemetryWebsocketService extends WebsocketService(); + this.subscriberCmdIds.set(subscriber, cmdIds); + } + cmdIds.add(cmdId); } subscriptionCommand.cmdId = cmdId; this.cmdWrapper.cmds.push(subscriptionCommand); @@ -141,6 +147,13 @@ export class TelemetryWebsocketService extends WebsocketService implements WsServ lastCmdId = 0; subscribersCount = 0; subscribersMap = new Map(); + subscriberCmdIds = new Map>(); reconnectSubscribers = new Set(); pendingUpdates = new Set(); @@ -136,6 +137,7 @@ export abstract class WebsocketService implements WsServ } this.lastCmdId = 0; this.subscribersMap.clear(); + this.subscriberCmdIds.clear(); this.subscribersCount = 0; this.cmdWrapper.clear(); if (close) { @@ -304,10 +306,13 @@ export abstract class WebsocketService implements WsServ private processPendingUpdates() { if (this.pendingUpdates.size > 0) { - this.pendingUpdates.forEach((subscriber) => { - this.update(subscriber); - }); + const subscribers = Array.from(this.pendingUpdates); this.pendingUpdates.clear(); + for (const subscriber of subscribers) { + if (this.subscriberCmdIds.has(subscriber)) { + this.update(subscriber); + } + } } } }