diff options
| author | RblSb <msrblsb@gmail.com> | 2020-03-08 09:43:48 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2020-03-08 09:43:48 +0300 |
| commit | 39e12465aa30c79799e9c443f0fa393a07019cef (patch) | |
| tree | 678ab49f5766ed24d1211b0aa9394f4291fbffd4 /src/client | |
| parent | a156726fd7962dd51886b8ecfb0cfd54ef2343ae (diff) | |
Use wss protocol on https page
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/Main.hx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx index 918a81a..8edeb8f 100644 --- a/src/client/Main.hx +++ b/src/client/Main.hx @@ -67,7 +67,9 @@ class Main { } function openWebSocket(host:String, port:String):Void { - ws = new WebSocket('ws://$host:$port'); + var protocol = "ws:"; + if (Browser.location.protocol == "https:") protocol = "wss:"; + ws = new WebSocket('$protocol//$host:$port'); ws.onmessage = onMessage; ws.onopen = () -> { serverMessage(1); |
