From 724a351d960855cc6607663f850be41592fbc9a8 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 17 Nov 2021 14:01:35 -0600 Subject: [PATCH] Remove warnings and errors --- server.ts | 12 +++++++----- signaller_client.gd | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/server.ts b/server.ts index 9fb7369..7cf6bdc 100644 --- a/server.ts +++ b/server.ts @@ -62,11 +62,13 @@ class Client { send(message: Message) { try { - this.socket.send( - typeof message === "object" - ? ("json:" + JSON.stringify(message)) - : message, - ); + if (this.isConnected()) { + this.socket.send( + typeof message === "object" + ? ("json:" + JSON.stringify(message)) + : message, + ); + } } catch (e) { console.error( `Failed to send on socket ${this.socket} to client ${this.id}. Disconnecting and removing...`, diff --git a/signaller_client.gd b/signaller_client.gd index 3fc6716..a720785 100644 --- a/signaller_client.gd +++ b/signaller_client.gd @@ -35,7 +35,7 @@ func connect_to_websocket_signaller(url: String): print("Attempting to connect to WebSocket signalling server at ", url) var _result = ws.connect_to_url(url) -func _closed(): +func _closed(_unknown): emit_signal("websocket_disconnected") func _close_request(code: int, reason: String):