stop using a hardcoded websocket address in ws_client
This commit is contained in:
parent
cafba23610
commit
461d648ac9
1 changed files with 8 additions and 2 deletions
|
|
@ -5,8 +5,14 @@ open Shared
|
||||||
let ws =
|
let ws =
|
||||||
Format.printf "create websocket@\n";
|
Format.printf "create websocket@\n";
|
||||||
let ws_url =
|
let ws_url =
|
||||||
(* TODO fix hostname *)
|
let location = Window.location G.window in
|
||||||
Jstr.of_string "ws://localhost:3696/island/ws"
|
let host = Uri.host location |> Jstr.to_string in
|
||||||
|
let port =
|
||||||
|
Option.fold ~none:""
|
||||||
|
~some:(fun port -> Format.sprintf ":%d" port)
|
||||||
|
(Uri.port location)
|
||||||
|
in
|
||||||
|
Jstr.of_string @@ Format.sprintf "ws://%s%s/island/ws" host port
|
||||||
in
|
in
|
||||||
Websocket.create ws_url
|
Websocket.create ws_url
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue