aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--portal/lib/portal_ws.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/portal/lib/portal_ws.ml b/portal/lib/portal_ws.ml
index b808733..cadbf41 100644
--- a/portal/lib/portal_ws.ml
+++ b/portal/lib/portal_ws.ml
@@ -92,4 +92,14 @@ let connect domain =
let open Lwt_stream in
let+ stream, ws_push = ws_endpoint domain >|= ws_stream in
let _streamed_stanzas, _push = create () in
+ let open Stdlib.Buffer in
+ let buf = create 1024 in (* NOTE: placeholder, ideally this should be the ~size of an XMPP stanza *)
+ let _send_frame () =
+ (* We create a buffer a single time, and clear it for every generated WebSocket frame. *)
+ Some (contents buf) |> ws_push;
+ clear buf
+ and _close_stream () =
+ Some stanza_close |> ws_push;
+ ws_push None;
+ in
stream, ws_push