Compare commits

..

2 Commits

4 changed files with 15 additions and 2 deletions

View File

@@ -1,5 +1,12 @@
# Changelog
## 2026-02-26 - 4.1.1 - fix(typedsocket)
reject pending requests on disconnect to avoid hanging promises
- Rejects all pending requests with Error('TypedSocket disconnected') when connection is lost
- Clears pendingRequests map to prevent memory leaks
- Preserves existing auto-reconnect scheduling behavior
## 2025-12-04 - 4.1.0 - feat(typedsocket)
Add SmartServe integration, tagging and improved client reconnect/backoff; update deps and tests

View File

@@ -1,6 +1,6 @@
{
"name": "@api.global/typedsocket",
"version": "4.1.0",
"version": "4.1.1",
"private": false,
"description": "A library for creating typed WebSocket connections, supporting bi-directional communication with type safety.",
"main": "dist_ts/index.js",

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedsocket',
version: '4.1.0',
version: '4.1.1',
description: 'A library for creating typed WebSocket connections, supporting bi-directional communication with type safety.'
}

View File

@@ -325,6 +325,12 @@ export class TypedSocket {
this.updateStatus('disconnected');
// Reject all pending requests — the connection is gone and they'll never receive a response
for (const [id, pending] of this.pendingRequests) {
pending.reject(new Error('TypedSocket disconnected'));
}
this.pendingRequests.clear();
if (this.clientOptions?.autoReconnect && this.retryCount < this.clientOptions.maxRetries) {
this.scheduleReconnect();
}