From 74ea7cd05d59c1b3a13bc697aa7a5623cca2f119 Mon Sep 17 00:00:00 2001 From: Clombrong Date: Sun, 10 Aug 2025 20:37:25 +0200 Subject: test(hello): try state management for connection --- test/hello.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/hello.ml b/test/hello.ml index c34f0a0..dd06554 100644 --- a/test/hello.ml +++ b/test/hello.ml @@ -14,7 +14,14 @@ let main = other = []; } in - try%lwt connect config.sasl.jid.domainpart config >|= (fun (portal, _) -> portal.push None) + let state, update = Lwt_react.S.create Disconnected in + Lwt_react.S.map (function + | Disconnected -> print_endline "Disconnected" + | Connecting -> print_endline "Connecting" + | Connected (portal, _) -> portal.push None) + state |> ignore; + try%lwt connect config.sasl.jid.domainpart config >|= + (fun (portal, state) -> update (Connected (portal, state))) with exn -> begin (* I suspect JavaScript's [wrap_callback] swallows the Exceptions thrown by -- cgit v1.2.3