diff options
Diffstat (limited to 'test/hello.ml')
-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 |