From edfe4a444eadb3353a850467d8a6bdbf0c5bb5ab Mon Sep 17 00:00:00 2001 From: RblSb Date: Sun, 12 Jul 2020 21:07:10 +0300 Subject: Fix wss connection on Heroku closes #2 --- src/client/Main.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/client/Main.hx') diff --git a/src/client/Main.hx b/src/client/Main.hx index c8750ca..89a6ac6 100644 --- a/src/client/Main.hx +++ b/src/client/Main.hx @@ -48,7 +48,6 @@ class Main { if (host == "") host = "localhost"; this.host = host; if (port == null) port = Browser.location.port; - if (port == "") port = "80"; final defaults:ClientSettings = { version: SETTINGS_VERSION, @@ -102,9 +101,10 @@ class Main { } function openWebSocket(host:String, port:String):Void { + if (port.length > 0) port = ':$port'; var protocol = "ws:"; if (Browser.location.protocol == "https:") protocol = "wss:"; - ws = new WebSocket('$protocol//$host:$port'); + ws = new WebSocket('$protocol//$host$port'); ws.onmessage = onMessage; ws.onopen = () -> { serverMessage(1); -- cgit v1.2.3