open Lwt.Syntax exception InvalidStanza of string let start domain : Portal.t Lwt.t = (** [start domain] is a promise containing a Portal (stream * push) connected to the XMPP server [domain]. Currently, it doesn't handle anything except the initial [] stanza. *) let* stream, _push = Portal.connect domain in let push = function | None -> _push (Some Portal.stanza_close); _push None; | anything -> _push anything in Some (Portal.stanza_open domain) |> push; (* TODO: check this is a good stanza *) let+ _ = Lwt_stream.get stream in stream, push