summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cask/util/src-js/cask/util/WebsocketClientImpl.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/cask/util/src-js/cask/util/WebsocketClientImpl.scala b/cask/util/src-js/cask/util/WebsocketClientImpl.scala
index f129893..bab6e38 100644
--- a/cask/util/src-js/cask/util/WebsocketClientImpl.scala
+++ b/cask/util/src-js/cask/util/WebsocketClientImpl.scala
@@ -28,6 +28,8 @@ abstract class WebsocketClientImpl(url: String) extends WebsocketBase{
def onError(ex: Exception): Unit
def onMessage(value: String): Unit
def onClose(code: Int, reason: String): Unit
- def close(): Unit = websocket.close()
+ def close(): Unit = {
+ if (!closed) websocket.close()
+ }
def isClosed() = closed
-} \ No newline at end of file
+}