diff options
-rw-r--r-- | scripts/client.js | 3 | ||||
-rw-r--r-- | scripts/socket/sock.js | 8 |
2 files changed, 5 insertions, 6 deletions
diff --git a/scripts/client.js b/scripts/client.js index 4d27bc5..c243d9f 100644 --- a/scripts/client.js +++ b/scripts/client.js @@ -94,8 +94,7 @@ class Client{ // Callback when negotiating with the server for the first time and we are determining versions handshake (e) { - let m = e.detail; - switch (m.type) { + switch (e.detail) { case "verr": this.socket.close(); diff --git a/scripts/socket/sock.js b/scripts/socket/sock.js index 4c64e02..a52faf4 100644 --- a/scripts/socket/sock.js +++ b/scripts/socket/sock.js @@ -11,12 +11,12 @@ class SockWorker extends EventTarget{ this.server = serveraddr; this.version = version; - this.handshake = false; + this.handshake = true; } // Initialize the connection. init () { - this.handshake = false; + this.handshake = true; if(this.server == "" || this.server == null) { return; } @@ -44,9 +44,9 @@ class SockWorker extends EventTarget{ if(typeof e.data == "string") { let dat = JSON.parse(e.data); - if (!this.handshake) { + if (this.handshake) { if (dat.type == "ready") - this.handshake = true; + this.handshake = false; this.dispatchEvent(new CustomEvent("handshake", {detail: dat.type})); return; } |