blob: 8c7a8f3b67b040adbc78042f7f41eda158f57cd7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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 [<open/>] 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
|