aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClombrong <clombrong@egregore.fun>2025-05-09 12:15:23 +0200
committerClombrong <cromblong@egregore.fun>2025-05-09 12:15:23 +0200
commitbb7784eca20d52d2c2a46ac5c301da02d09d57ae (patch)
tree7b7b05506f9bcc2b8d63a2ece2c9f0917cb3fb3f
parentb6ec8b97308f394c99c7bd22ffa16ae8c4ee2ca2 (diff)
feat(portal_ws): add markup-lwt to connect
-rw-r--r--portal/lib/portal_ws.ml7
1 files changed, 5 insertions, 2 deletions
diff --git a/portal/lib/portal_ws.ml b/portal/lib/portal_ws.ml
index 69e415e..ecbbe60 100644
--- a/portal/lib/portal_ws.ml
+++ b/portal/lib/portal_ws.ml
@@ -104,7 +104,10 @@ let connect domain =
in
(* Consumes a stream of stanzas fragments into a series of frames sent to the WebSocket. *)
(* Right now... This doesn't do much. *)
- let to_frames stream =
- let+ _ = Lwt_stream.iter (fun x -> ws_push (Some x)) stream in ws_push None
+ let to_frames fragments =
+ let stanzas =
+ let open Markup_lwt in
+ lwt_stream fragments |> to_lwt_stream
+ in let+ _ = Lwt_stream.iter (fun x -> ws_push (Some x)) stanzas in ws_push None
in Lwt.async @@ (fun () -> to_frames streamed_stanzas);
stream, push