From 644596a009e74573b313e9305ae9332d1c80223d Mon Sep 17 00:00:00 2001 From: Jake Merdich Date: Sat, 15 Feb 2020 17:27:47 -0500 Subject: [PATCH 1/2] In the heartbeat example, stop the timer on close. This was hanging node after tests when I included it in my application. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 4da2e1ff0..00c305def 100644 --- a/README.md +++ b/README.md @@ -430,6 +430,10 @@ const interval = setInterval(function ping() { ws.ping(noop); }); }, 30000); + +wss.on('close', function() { + clearInterval(interval); +}); ``` Pong messages are automatically sent in response to ping messages as required by From 1f1509d0d036a1472b3a1220a3b83f2b3a988d2d Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sun, 16 Feb 2020 18:52:24 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00c305def..196455562 100644 --- a/README.md +++ b/README.md @@ -431,7 +431,7 @@ const interval = setInterval(function ping() { }); }, 30000); -wss.on('close', function() { +wss.on('close', function close() { clearInterval(interval); }); ```