Skip to content

Commit a39756a

Browse files
authored
[doc] Clear the timer on close (#1696)
In the heartbeat example, clear the timer on close.
1 parent 9535702 commit a39756a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,10 @@ const interval = setInterval(function ping() {
430430
ws.ping(noop);
431431
});
432432
}, 30000);
433+
434+
wss.on('close', function close() {
435+
clearInterval(interval);
436+
});
433437
```
434438

435439
Pong messages are automatically sent in response to ping messages as required by

0 commit comments

Comments
 (0)