diff options
author | Clombrong <clombrong@egregore.fun> | 2025-05-08 20:04:47 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-05-08 20:04:47 +0200 |
commit | 512f656a287f7aa8f78c65925dc2a843ec93e7aa (patch) | |
tree | a29b62f5cac924536d202cd625119870564db6e1 | |
parent | 1561aa11046b326c915d711d17103601a921be30 (diff) |
feat: start xmlm to markup.ml migration
-rw-r--r-- | portal/lib/dune | 2 | ||||
-rw-r--r-- | portal/lib/portal_ws.ml | 9 |
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] |