From 824f1c0aa9cc448d054b5b8997036bc3ce78d646 Mon Sep 17 00:00:00 2001 From: Clombrong Date: Tue, 17 Jun 2025 17:07:56 +0200 Subject: feat(websockets_hello): close stream after main --- test/js/websockets_hello.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/js') diff --git a/test/js/websockets_hello.ml b/test/js/websockets_hello.ml index d417e62..316ae5e 100644 --- a/test/js/websockets_hello.ml +++ b/test/js/websockets_hello.ml @@ -1,4 +1,5 @@ open Lwt.Syntax +open Lwt.Infix open Js_of_ocaml open Flesh @@ -21,8 +22,7 @@ let main (stream, push) localpart password = in let+ _auth = Sasl.send_auth_stanza (stream, push) localpart password Sasl.PLAIN - in push None; - match _auth with + in match _auth with | Error (NotAuthorized, Some (_, text)) -> print_endline ("Not authorized: " ^ text) | Error (MalformedRequest, Some (_, text)) -> print_endline ("Malformed request: " ^ text) | Error _ -> print_endline "Error!" @@ -40,5 +40,5 @@ let () = in let* stream, push = Stream.start domain in Lwt.catch - (fun () -> main (stream, push) localpart password) + (fun () -> main (stream, push) localpart password >|= (fun () -> push None)) (fun exn -> push None; Lwt.fail exn) -- cgit v1.2.3