aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorClombrong <cromblong@egregore.fun>2025-08-14 23:46:52 +0200
committerClombrong <cromblong@egregore.fun>2025-08-15 00:13:57 +0200
commite4e8a81f030dc599b1d5dc84b9725667c3872124 (patch)
treea7b14daa695e1d5521b07d0fb5a3ff73a225b62b /lib
parent1283666e6cc07c3149667dfb3218a0dbae62abd6 (diff)
feat(session): add t type for session data
Diffstat (limited to 'lib')
-rw-r--r--lib/session.ml9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/session.ml b/lib/session.ml
index d0c2754..f4d5f94 100644
--- a/lib/session.ml
+++ b/lib/session.ml
@@ -14,6 +14,11 @@ type state =
(* TCP/WebSocket connected, not connected in XMPP-land *)
| Connected of Portal.t * step
+type t = {
+ state : state signal;
+ update : state -> unit;
+ }
+
(** [create domain config] is a promise containing a signal representing the portal
connected to the XMPP server located at [domain], and all its supported features.
@@ -22,7 +27,7 @@ type state =
Basically, it conforms to {{:
https://datatracker.ietf.org/doc/html/rfc6120#section-4.3 }}, and gets the Portal in
a "ready" state. *)
-let create (domain : string) (config : config) =
+let create (domain : string) (config : config) : t Lwt.t =
let needs_restart = function
| Feature.Mechanisms _ | STARTTLS -> true
| _ -> false
@@ -53,4 +58,4 @@ let create (domain : string) (config : config) =
in update (Connected (portal, next_state))
| _ -> Lwt.return_unit)
state >|= S.keep;
- in state, update
+ in { state; update }