diff options
author | Clombrong <cromblong@egregore.fun> | 2025-08-14 15:04:51 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-08-14 15:04:51 +0200 |
commit | d01cc81d90ee6428851142b22edbe2a04a5daed0 (patch) | |
tree | de27d6a1bc561616df9e88b83f8b4b9185e466da | |
parent | ed0065d2769a78c866e680697ebb70a6976708c6 (diff) |
feat(session): add connection_step type (granular connection step)
-rw-r--r-- | lib/session.ml | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/session.ml b/lib/session.ml index 94688bc..0abda51 100644 --- a/lib/session.ml +++ b/lib/session.ml @@ -2,10 +2,13 @@ open Lwt.Syntax open Lwt.Infix open Lwt_react +type connection_step = + | Starting_stream of string + type state = | Disconnected | Opening_portal of string - | Connecting of Portal.t + | Connecting of Portal.t * connection_step | Connected of Portal.t * Stream.features (** [create domain config] is a promise containing a signal representing the portal @@ -40,8 +43,8 @@ let create (domain : string) (config : Stream.config) : (state signal * (unit -> (function | Opening_portal domain -> let+ portal = Portal.connect domain - in update (Connecting portal) - | Connecting portal -> connect portal + in update (Connecting (portal, Starting_stream domain)) + | Connecting (portal, _) -> connect portal | _ -> Lwt.return_unit) state >|= S.keep; in state, fun () -> update (Opening_portal domain) |