Skip to content

Commit

Permalink
[doc] Clear the timer on close (#1696)
Browse files Browse the repository at this point in the history
In the heartbeat example, clear the timer on close.
  • Loading branch information
jmerdich committed Feb 16, 2020
1 parent 9535702 commit a39756a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -430,6 +430,10 @@ const interval = setInterval(function ping() {
ws.ping(noop);
});
}, 30000);

wss.on('close', function close() {
clearInterval(interval);
});
```

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

0 comments on commit a39756a

Please sign in to comment.