aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--portal/lib/dune2
-rw-r--r--portal/lib/portal_ws.ml9
2 files changed, 10 insertions, 1 deletions
diff --git a/portal/lib/dune b/portal/lib/dune
index 8ce0232..e2fb20a 100644
--- a/portal/lib/dune
+++ b/portal/lib/dune
@@ -2,5 +2,5 @@
(name portal_ws)
(modules portal_ws)
(public_name flesh_websockets)
- (libraries lwt js_of_ocaml js_of_ocaml-lwt xmlm)
+ (libraries lwt js_of_ocaml js_of_ocaml-lwt xmlm markup)
(preprocess (pps js_of_ocaml-ppx)))
diff --git a/portal/lib/portal_ws.ml b/portal/lib/portal_ws.ml
index fbdced7..9aeb1d4 100644
--- a/portal/lib/portal_ws.ml
+++ b/portal/lib/portal_ws.ml
@@ -15,6 +15,14 @@ let ws_endpoint (domain : string) =
Lastly, if [domain] doesn't provide a well-formed Web-host Metadata file, the function throws an exception. *)
let+ host_meta = Js_of_ocaml_lwt.XmlHttpRequest.perform_raw_url (well_known_of domain)
+ in let open Markup in
+ string host_meta.content
+ |> parse_xml
+ |> signals
+ |> write_xml
+ |> to_string
+
+(*
in let i = Xmlm.make_input (`String (0, host_meta.content))
(* This ugly function extracts the href element from a Link tag's attributes if it's a websocket. *)
and link_websocket = function
@@ -34,6 +42,7 @@ let ws_endpoint (domain : string) =
match parse_xrd i with
| Some uri -> uri
| None -> failwith (domain ^ "doesn't advertise a WebSocket endpoint via Web-host Metadata.")
+ *)
let ws_stream (url : string) =
(** [ws_stream url] returns an Lwt stream (and its push function) communicating with the websocket located at [url]