diff options
author | Clombrong <clombrong@egregore.fun> | 2025-05-08 21:15:42 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-05-08 21:15:42 +0200 |
commit | 9e315fd0223d56347db74f0f03dc7f853dd44ce4 (patch) | |
tree | 5fadbe8aab4a517c22b7b3af37a684da7f8b07b5 /portal/test | |
parent | dab49c354f6ff53c6c18eb7d659fb4c75f9c8164 (diff) |
feat(portal_ws): create connect function
Diffstat (limited to 'portal/test')
-rw-r--r-- | portal/test/js/websockets_hello.ml | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/portal/test/js/websockets_hello.ml b/portal/test/js/websockets_hello.ml index 76b70e4..1e8b364 100644 --- a/portal/test/js/websockets_hello.ml +++ b/portal/test/js/websockets_hello.ml @@ -17,15 +17,9 @@ let rec run t = let () = run @@ - let* ws = Portal_ws.ws_endpoint "squarebowl.club" in - let stream, push = - Portal_ws.ws_stream ws in - push (Some "malformed"); - let+ stanzas = stream - |> Lwt_stream.map - (fun stanza -> - match stanza with - | {|<close xmlns='urn:ietf:params:xml:ns:xmpp-framing'/>|} -> push None; stanza - | stanza -> stanza) - |> Lwt_stream.to_list - in List.map (fun x -> " >>> " ^ x) stanzas |> String.concat "\n" |> print_endline + let domain = "squarebowl.club" in + let* stream, push = + Portal_ws.connect domain in + push (Some {|<malformed/>|}); + let+ _ = Lwt_stream.iter (fun f -> print_endline f) stream + in push None |