From 1f9cc8a538e6cdc4842b54d3b4cfd6c51f853cfc Mon Sep 17 00:00:00 2001 From: Clombrong Date: Thu, 24 Apr 2025 18:31:27 +0200 Subject: feat: test a real XMPP connection --- portal/test/js/websockets_hello.ml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'portal/test/js/websockets_hello.ml') diff --git a/portal/test/js/websockets_hello.ml b/portal/test/js/websockets_hello.ml index fa47965..76b70e4 100644 --- a/portal/test/js/websockets_hello.ml +++ b/portal/test/js/websockets_hello.ml @@ -17,19 +17,15 @@ let rec run t = let () = run @@ - let* server = Portal_ws.ws_endpoint "telepath.im" in + let* ws = Portal_ws.ws_endpoint "squarebowl.club" in let stream, push = - (* Echo is a websocket that... echoes you stuff. *) - Portal_ws.ws_stream "wss://echo.websocket.org" in - push (Some "great text"); - push (Some "other text"); - push (Some "yet another text"); - push (Some "BYE"); - let+ _ = Lwt_stream.iter - (fun greetings -> - match greetings with - (* When the websocket sends "BYE", we close. *) - | "BYE" -> print_endline "CLOSING BYE"; push None - | hello -> print_endline ("> " ^ hello)) - stream - in print_endline server + Portal_ws.ws_stream ws in + push (Some "malformed"); + let+ stanzas = stream + |> Lwt_stream.map + (fun stanza -> + match stanza with + | {||} -> push None; stanza + | stanza -> stanza) + |> Lwt_stream.to_list + in List.map (fun x -> " >>> " ^ x) stanzas |> String.concat "\n" |> print_endline -- cgit v1.2.3