summary refs log tree commit diff
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2024-12-01 11:55:06 +0200
committerWlodekM <[email protected]>2024-12-01 11:55:06 +0200
commitd56e324b0d5f249c461428fdd976cc074b098be1 (patch)
treedbb0c00edd34c62f7a2ba72a444906ce9e868d90
parent33055d0dfd1a8db661240b5e18e5463f7799e45f (diff)
only ping after open
-rw-r--r--lib/sd.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sd.js b/lib/sd.js
index d8c461d..25b2cb9 100644
--- a/lib/sd.js
+++ b/lib/sd.js
@@ -32,7 +32,7 @@ export default class SoktDeer {
         this.wsEvents.on('new_post', ({ data: post }) => {
             this.messages.push(post)
         })
-        setInterval(ping, 5000)
+        this.ws.onopen = () => setInterval(ping, 5000)
     }
     login(username, password) {
         return new Promise((resolve, reject) => {