Skip to content

Commit

Permalink
refactor: reset ping timeout on any incoming packet (#706)
Browse files Browse the repository at this point in the history
The client will now match the behavior of the server.

See also: socketio/engine.io@be7b4e7
  • Loading branch information
cdewbery authored and darrachequesne committed Aug 1, 2023
1 parent 8270e00 commit ed34a45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -663,14 +663,14 @@ export class Socket extends Emitter<

// Socket is live - any packet counts
this.emitReserved("heartbeat");
this.resetPingTimeout();

switch (packet.type) {
case "open":
this.onHandshake(JSON.parse(packet.data));
break;

case "ping":
this.resetPingTimeout();
this.sendPacket("pong");
this.emitReserved("ping");
this.emitReserved("pong");
Expand Down

0 comments on commit ed34a45

Please sign in to comment.