Skip to content

Commit

Permalink
Fix WebSockets counter
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlika committed Jun 23, 2024
1 parent de652b9 commit 8d9fa21
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/uws-tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ export class UWebSocketsTracker {
compression: this.settings.websockets.compression,
maxPayloadLength: this.settings.websockets.maxPayloadLength,
idleTimeout: this.settings.websockets.idleTimeout,
open: this.onOpen,
upgrade: this.onUpgrade,
drain: (ws: WebSocket<SocketContext>) => {
if (debugWebSocketsEnabled) {
Expand All @@ -196,10 +195,6 @@ export class UWebSocketsTracker {
});
}

private readonly onOpen = (): void => {
this.webSocketsCount++;
};

private readonly onUpgrade = (
response: HttpResponse,
request: HttpRequest,
Expand Down Expand Up @@ -276,6 +271,8 @@ export class UWebSocketsTracker {
);
}

this.webSocketsCount++;

response.upgrade<Omit<SocketContext, "ws">>(
{
sendMessage,
Expand Down

0 comments on commit 8d9fa21

Please sign in to comment.