stop using a hardcoded websocket address in ws_client
This commit is contained in:
parent
caffcbb527
commit
cdd46850bf
1 changed files with 8 additions and 2 deletions
|
|
@ -5,8 +5,14 @@ open Shared
|
|||
let ws =
|
||||
Format.printf "create websocket@\n";
|
||||
let ws_url =
|
||||
(* TODO fix hostname *)
|
||||
Jstr.of_string "ws://localhost:3696/island/ws"
|
||||
let location = Window.location G.window in
|
||||
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
|
||||
Websocket.create ws_url
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue