From 9512487dec3780dd1d5125537479b6e392010d3b Mon Sep 17 00:00:00 2001 From: Vladimir Dementyev Date: Tue, 9 Apr 2024 17:12:50 -0700 Subject: [PATCH] fix: transport.close must call ws.close even if not connected --- packages/core/CHANGELOG.md | 4 ++++ packages/core/package.json | 2 +- packages/core/websocket/index.js | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 10190ac..b479ca1 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -2,6 +2,10 @@ ## master +## 0.8.3 (2024-04-09) + +- Fix closing WebSocket right after opening. ([@palkan][]) + ## 0.8.2 (2024-03-27) - Fix whispering for pub/sub channels. ([@palkan][]) diff --git a/packages/core/package.json b/packages/core/package.json index ac8687e..009d249 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@anycable/core", - "version": "0.8.2", + "version": "0.8.3", "description": "AnyCable JavaScript client library core functionality", "keywords": [ "anycable", diff --git a/packages/core/websocket/index.js b/packages/core/websocket/index.js index 1707386..88d049b 100644 --- a/packages/core/websocket/index.js +++ b/packages/core/websocket/index.js @@ -80,8 +80,10 @@ export class WebSocketTransport { } close() { - if (this.ws && this.connected) { + if (this.ws) { this.onclose() + } else { + this.connected = false } }