From 31fac6c095b4de24ee57a7d0b6abcc3c1882f6a5 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 18 Aug 2023 08:56:59 +1000 Subject: [PATCH] 0.2.5-0.0.1 - Fix: TCP Socket Wrapper (#48) * Fix tcp socket wrapper close handling * Inc version --- package.json | 2 +- src/socket-wrapper.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f39ed85..b53ef6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lnmessage", - "version": "0.2.5", + "version": "0.2.5-0.0.1", "description": "Talk to Lightning nodes from your browser", "main": "dist/index.js", "type": "module", diff --git a/src/socket-wrapper.ts b/src/socket-wrapper.ts index adfd840..81648bf 100644 --- a/src/socket-wrapper.ts +++ b/src/socket-wrapper.ts @@ -17,6 +17,7 @@ class SocketWrapper { socket.on('close', () => { this.onclose && this.onclose() + socket.removeAllListeners() }) socket.on('error', (error) => { @@ -32,8 +33,7 @@ class SocketWrapper { } this.close = () => { - socket.removeAllListeners() - socket.destroy() + socket.end() } const url = new URL(connection)