From ac3e8c0f43e66437da59edbf054af87b0083a041 Mon Sep 17 00:00:00 2001 From: Hellgren Heikki Date: Thu, 27 Feb 2025 09:02:46 +0200 Subject: [PATCH] fix(signals): prevent duplicate connect requests the ws state might not be OPEN when connect is called thus leading to multiple connect calls being done. it should be sufficient to check that we have the ws instance when starting to connect. Signed-off-by: Hellgren Heikki --- .changeset/loud-clocks-obey.md | 5 +++++ plugins/signals/src/api/SignalClient.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/loud-clocks-obey.md diff --git a/.changeset/loud-clocks-obey.md b/.changeset/loud-clocks-obey.md new file mode 100644 index 0000000000..f6e6828427 --- /dev/null +++ b/.changeset/loud-clocks-obey.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-signals': patch +--- + +Fixed multiple signal connection attempts when there are multiple subscriptions at the same time diff --git a/plugins/signals/src/api/SignalClient.ts b/plugins/signals/src/api/SignalClient.ts index feccf4a105..7ffb88f66f 100644 --- a/plugins/signals/src/api/SignalClient.ts +++ b/plugins/signals/src/api/SignalClient.ts @@ -135,7 +135,7 @@ export class SignalClient implements SignalApi { } private async connect() { - if (this.ws && this.ws.readyState === WebSocket.OPEN) { + if (this.ws && this.ws.readyState !== WebSocket.CLOSED) { return; }