diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2022-07-25 22:34:33 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2022-07-25 22:34:33 -0400 |
commit | a97fcacb0ce4d2f30fbe989ec1f62f6bd95c7e9a (patch) | |
tree | 5d15a4ddda7a3b286f9833b4368df61799d7d49d /scripts/socket | |
parent | 380bfaeeeadbd7c3d6d0ee79551fedb35d597d8c (diff) |
Change handshake code again
Diffstat (limited to 'scripts/socket')
-rw-r--r-- | scripts/socket/sock.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/socket/sock.js b/scripts/socket/sock.js index a52faf4..73e20ee 100644 --- a/scripts/socket/sock.js +++ b/scripts/socket/sock.js @@ -20,6 +20,11 @@ class SockWorker extends EventTarget{ if(this.server == "" || this.server == null) { return; } + + if(this.socket != null) { + this.socket.close(); + } + try { this.socket = new WebSocket(this.server); @@ -47,7 +52,7 @@ class SockWorker extends EventTarget{ if (this.handshake) { if (dat.type == "ready") this.handshake = false; - this.dispatchEvent(new CustomEvent("handshake", {detail: dat.type})); + this.dispatchEvent(new CustomEvent("handshake", {detail: dat})); return; } |