aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClombrong <cromblong@egregore.fun>2025-08-15 00:12:39 +0200
committerClombrong <cromblong@egregore.fun>2025-08-15 00:14:31 +0200
commite9c9de288d9934a252dcef58b935ce6e145a65cd (patch)
treed61d6951f5f11538fab8c8f58d211547b226ef45
parent5d31409b2e1a3624b23e894b606c1412546fc5ee (diff)
feat(portal): add domain to portal type
-rw-r--r--portal/portal.mli1
-rw-r--r--portal/tcp/portal.ml3
-rw-r--r--portal/ws/portal.ml3
3 files changed, 5 insertions, 2 deletions
diff --git a/portal/portal.mli b/portal/portal.mli
index 10b6bc3..52a96ce 100644
--- a/portal/portal.mli
+++ b/portal/portal.mli
@@ -17,6 +17,7 @@ val domain_to_string : domain -> string
[push None] closes the XMPP stream and disconnects the underlying [_socket]. This is
how XMPP streams should be ended. *)
type t = {
+ domain : domain;
mutable stream : (signal, async) stream;
mutable push : (signal, sync) stream option -> unit;
mutable _socket : socket;
diff --git a/portal/tcp/portal.ml b/portal/tcp/portal.ml
index a3f163e..b776efc 100644
--- a/portal/tcp/portal.ml
+++ b/portal/tcp/portal.ml
@@ -11,6 +11,7 @@ let domain_of_string (s : string) : domain = s
let domain_to_string (s : domain) : string = s
type t = {
+ domain : domain;
mutable stream : (signal, async) stream;
mutable push : (signal, sync) stream option -> unit;
mutable _socket : socket;
@@ -173,7 +174,7 @@ let connect (domain : string) : t Lwt.t =
let+ s = tcp_socket domain in
let _socket = Plain s
in let stream, push = socket_to_stream _socket
- in {stream; push; _socket=_socket}
+ in {domain; stream; push; _socket=_socket}
(** [upgrade_to_tls fd] returns a promise to an [Tls_lwt.Unix.t] socket that wraps
[fd] with STARTTLS. *)
diff --git a/portal/ws/portal.ml b/portal/ws/portal.ml
index 6b42216..636cb89 100644
--- a/portal/ws/portal.ml
+++ b/portal/ws/portal.ml
@@ -14,6 +14,7 @@ let domain_of_string (s : string) : domain = s
let domain_to_string (s : domain) : string = s
type t = {
+ domain : domain;
mutable stream : (signal, async) stream;
mutable push : (signal, sync) stream option -> unit;
mutable _socket : socket;
@@ -167,7 +168,7 @@ let connect domain =
|> map (fun x -> write_xml x |> to_string)
|> to_lwt_stream
|> Lwt_stream.iter (fun s -> ws_push (Some s)));
- {stream; push; _socket=ws}
+ {domain; stream; push; _socket=ws}
let starttls _ = Lwt.fail_with "STARTTLS is unimplemented in WebSockets."