From 93a85ad37cefc4a704005d3e08f8afcd77bd43c0 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Thu, 9 Jan 2020 14:08:50 -0500 Subject: added write counter and simplified Socket.write --- socket.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/socket.js b/socket.js index dfd0999..aefc1c0 100644 --- a/socket.js +++ b/socket.js @@ -32,6 +32,7 @@ class Socket extends retryws { let loc = (world == '') ? '' : `${world}/`; let addr = `wss://www.yourworldoftext.com/${loc}ws/`; super(addr); + let writect = 0; // A running counter to make the server write confirmations meaningful this.on('message', (msg)=>{ msg = JSON.parse(msg); switch (msg.kind){ @@ -62,23 +63,25 @@ class Socket extends retryws { if (chars.length > 200){ throw "Too many characters to write by server decree"; } - for (var i=0; i