blob: 25b68225ddf6c8175e9d65271dbb509e1fd828fb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
open Lwt.Syntax
exception ClosedStream
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
|