From 1d3383c8c622ed1d5ee5492b4c469bb02042b754 Mon Sep 17 00:00:00 2001 From: Kato Twofold Date: Mon, 6 Jun 2022 22:49:55 +0300 Subject: [PATCH] * Removed deprecated variable --- static/js/ws.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/static/js/ws.js b/static/js/ws.js index cc9f75c..8fe8e7b 100644 --- a/static/js/ws.js +++ b/static/js/ws.js @@ -2,10 +2,6 @@ class PadSocket { ws = null; padName = null; - /** - * @deprecated - */ - state = null; /** * Create a new PadSocket @@ -22,10 +18,6 @@ class PadSocket { // Connect to the websocket const ws = new WebSocket(connUrl); - ws.onopen = () => { - // TODO: This is redundant, we could check the websocket status: ws.readyState == WebSocket.OPEN - this.state = 'active'; - } // Bind the onMessage function ws.onmessage = this.handleMessage; @@ -43,7 +35,7 @@ class PadSocket { */ sendMessage = (eventType, message) => { - if ( this.state != 'active' ) { + if ( this.ws.readyState !== WebSocket.OPEN ) { throw new Error(`The websocket connection is not active`); }