diff options
author | Clombrong <cromblong@egregore.fun> | 2025-08-10 20:37:25 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-08-11 11:41:24 +0200 |
commit | 74ea7cd05d59c1b3a13bc697aa7a5623cca2f119 (patch) | |
tree | f6cae0529279cfdcb813539e91e51df1904b843f | |
parent | 78af2bac103ade168409506ce07b58654de524b3 (diff) |
test(hello): try state management for connection
-rw-r--r-- | test/hello.ml | 9 |
1 files changed, 8 insertions, 1 deletions
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 |