From 59799d12c620380734e2fc24a5bf30b5471ac2f6 Mon Sep 17 00:00:00 2001 From: ugyballoons Date: Mon, 23 Sep 2024 16:28:06 +0100 Subject: [PATCH] Create TODO for simplifying ws class --- src/js/modules/ws-service-client.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/js/modules/ws-service-client.js b/src/js/modules/ws-service-client.js index 62d4fa2..ea26b3f 100644 --- a/src/js/modules/ws-service-client.js +++ b/src/js/modules/ws-service-client.js @@ -2,10 +2,12 @@ import ReconnectingWebSocket from "reconnecting-websocket" import { validate } from "uuid" import { getWebSockURL } from "./utils" +// TODO - Simplify this class since subscriptionType is no longer rqrd. +// See DM-46449 + export class WebsocketClient { constructor() { this.connectionID = null - this.latestDataBySubscription = new Map() // Store latest data per subscription this.ws = new ReconnectingWebSocket(getWebSockURL("ws/data")) this.ws.onmessage = this.handleMessage.bind(this) this.ws.onclose = this.handleClose.bind(this) @@ -94,7 +96,6 @@ export class WebsocketClient { data: data.payload, datestamp: data.datestamp, } - this.latestDataBySubscription.set(data.dataType, detail) // Store the latest data by subscription type window.dispatchEvent(new CustomEvent(data.dataType, { detail })) } } @@ -118,9 +119,4 @@ export class WebsocketClient { this.ws.send(JSON.stringify(message)) } } - - // New method to retrieve the latest detail for a specific subscription - getLatestDataForSubscription(subscriptionType) { - return this.latestDataBySubscription.get(subscriptionType) || null - } }