From b597b7530e0e05e3b56e74f5c55e6e9b11b9c4f3 Mon Sep 17 00:00:00 2001 From: Jesse Mazzella Date: Fri, 12 Apr 2024 13:23:36 -0700 Subject: [PATCH] fix: revert BatchingWebSocket changes --- src/api/telemetry/BatchingWebSocket.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/telemetry/BatchingWebSocket.js b/src/api/telemetry/BatchingWebSocket.js index dadfd52438..992a7d3ca7 100644 --- a/src/api/telemetry/BatchingWebSocket.js +++ b/src/api/telemetry/BatchingWebSocket.js @@ -19,7 +19,7 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ - +import installWorker from './WebSocketWorker.js'; /** * Describes the strategy to be used when batching WebSocket messages * @@ -69,7 +69,10 @@ class BatchingWebSocket extends EventTarget { constructor(openmct) { super(); // Install worker, register listeners etc. - this.#worker = new Worker(new URL('./WebSocketWorker.js', import.meta.url)); + const workerFunction = `(${installWorker.toString()})()`; + const workerBlob = new Blob([workerFunction]); + const workerUrl = URL.createObjectURL(workerBlob, { type: 'application/javascript' }); + this.#worker = new Worker(workerUrl); this.#openmct = openmct; this.#showingRateLimitNotification = false; this.#maxBatchSize = Number.POSITIVE_INFINITY; @@ -83,6 +86,7 @@ class BatchingWebSocket extends EventTarget { 'destroy', () => { this.disconnect(); + URL.revokeObjectURL(workerUrl); }, { once: true } );