use wss instead of ws when not on localhost

This commit is contained in:
zapashcanon 2023-01-10 05:07:07 +01:00
parent 0fcd970445
commit b0d466ac08
No known key found for this signature in database
GPG key ID: 8981C3C62D1D28F1

View file

@ -11,7 +11,8 @@ let ws =
~some:(fun port -> Format.sprintf ":%d" port)
(Uri.port location)
in
Jstr.of_string @@ Format.sprintf "ws://%s%s/island/ws" host port
let ws = if host = "localhost" then "ws" else "wss" in
Jstr.of_string @@ Format.sprintf "%s://%s%s/island/ws" ws host port
in
Websocket.create ws_url