From 4163ee92d7c358ea22134b16d4a5a6dda97c6e6f Mon Sep 17 00:00:00 2001 From: Angus ZENG Date: Fri, 22 Mar 2024 22:25:25 +0800 Subject: [PATCH] fix(client): connection close during handshaking should not throw an error --- CHANGES.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- src/lib/Client.ts | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e5748b2..1db89aa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +## v0.2.1 + +- fix(client): connection close during handshaking should not throw an error. + ## v0.2.0 - build(project): use term `message` instead of `frame`. diff --git a/package-lock.json b/package-lock.json index 51ccabc..a906b14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@litert/websocket", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@litert/websocket", - "version": "0.2.0", + "version": "0.2.1", "license": "Apache-2.0", "devDependencies": { "@commitlint/cli": "^18.6.0", diff --git a/package.json b/package.json index 78a6cce..64da0f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@litert/websocket", - "version": "0.2.0", + "version": "0.2.1", "description": "The websocket protocol library for LiteRT.", "main": "lib/index.js", "scripts": { diff --git a/src/lib/Client.ts b/src/lib/Client.ts index 8853a6a..1d5853f 100644 --- a/src/lib/Client.ts +++ b/src/lib/Client.ts @@ -222,6 +222,10 @@ function connect( resolve(ws); }) + .on('close', () => { + + reject(new E.E_HANDSHAKE_FAILED('Connection closed')); + }) .on('error', (e) => { reject(e);