blob: 604e360f3dded67668f5c0bc3085978bc71946cf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
open Markup
exception MalformedStanza of Error.t
type socket
(** Opaque domain name type. *)
type domain
val domain_of_string : string -> domain
val domain_to_string : domain -> string
(** The type of portals communicating with an XMPP stream to the server located at [_socket].
[stream] is the data sent to the XMPP server.
[push None] closes the XMPP stream and disconnects the underlying [_socket]. This is
how XMPP connections should be ended. *)
type t = {
stream : (signal, async) stream;
push : (signal, sync) stream option -> unit;
mutable _socket : socket;
}
(** This is the XML namespace of the underlying element stream.
You can rely on it on your code, as an escape hatch, but you should probably not,
since the Portal interface is supposed to be agnostic. *)
val xmlns : string
(** [connect domain] returns a socket connected to the XMPP server [domain]. *)
val connect : domain -> socket Lwt.t
(** [starttls socket] returns a TLS-encrypted [socket] wrapping the original socket.
Once this function is called, the old socket and the portal depending on this socket
MUST NOT be used. *)
val starttls : socket -> socket Lwt.t
(** [stream socket] sends an initial stream header to the XMPP server [socket]. It
returns a Portal, connected to the given socket.
When [from] is specified, a from attribute is included. *)
val stream : ?from:string -> socket -> t Lwt.t
(** [_encrypted socket] returns whether [socket] is encrypted, using TLS or otherwise. *)
val _encrypted : socket -> bool
|