Skip to content

Commit ea283dd

Browse files
committed
fix: changed WS close error code
1 parent f5030d6 commit ea283dd

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/websockets/WebSocketClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ class WebSocketStreamClientInternal extends WebSocketStream {
467467
}
468468
// Then close the websocket
469469
if (!this._webSocketEnded) {
470-
this.ws.close(4001, 'Ending connection');
470+
this.ws.close(4000, 'Ending connection');
471471
this.signalWebSocketEnd(err);
472472
}
473473
}

src/websockets/WebSocketServer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ class WebSocketStreamServerInternal extends WebSocketStream {
416416
if (this._readableEnded && !this._webSocketEnded) {
417417
writableLogger.debug('Ending socket');
418418
this.signalWebSocketEnd(reason);
419-
ws.end(4001, 'ABORTED');
419+
ws.end(4000, 'Aborting connection');
420420
}
421421
},
422422
});
@@ -448,7 +448,7 @@ class WebSocketStreamServerInternal extends WebSocketStream {
448448
const err = new webSocketErrors.ErrorServerReadableBufferLimit();
449449
if (!this._webSocketEnded) {
450450
this.signalWebSocketEnd(err);
451-
ws.end(4001, 'Read stream buffer full');
451+
ws.end(4000, 'Read stream buffer full');
452452
}
453453
controller.error(err);
454454
}
@@ -527,7 +527,7 @@ class WebSocketStreamServerInternal extends WebSocketStream {
527527
}
528528
// Then close the websocket
529529
if (!this._webSocketEnded) {
530-
this.ws.end(4001, 'Ending connection');
530+
this.ws.end(4000, 'Ending connection');
531531
this.signalWebSocketEnd(err);
532532
}
533533
}

0 commit comments

Comments
 (0)