diff options
author | Clombrong <clombrong@egregore.fun> | 2025-05-30 14:37:16 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-05-30 14:37:16 +0200 |
commit | 0313c8c3f635752b649b00dcfc21922305b75190 (patch) | |
tree | 674564f67a7ab8bf654388e96c3428605f946b82 /test/js | |
parent | bef93807616077801b10d4bb35106e2e1368a4e1 (diff) |
feat!: new module Stream
Diffstat (limited to 'test/js')
-rw-r--r-- | test/js/dune | 2 | ||||
-rw-r--r-- | test/js/websockets_hello.ml | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/test/js/dune b/test/js/dune index b34c980..f6cc084 100644 --- a/test/js/dune +++ b/test/js/dune @@ -1,6 +1,6 @@ (test (name websockets_hello) - (libraries portal_ws lwt js_of_ocaml) + (libraries portal_ws lwt js_of_ocaml flesh) (modes js) (preprocess (pps js_of_ocaml-ppx)) (deps node_modules) diff --git a/test/js/websockets_hello.ml b/test/js/websockets_hello.ml index 5705dc9..6bc863b 100644 --- a/test/js/websockets_hello.ml +++ b/test/js/websockets_hello.ml @@ -1,5 +1,6 @@ open Lwt.Syntax open Js_of_ocaml +open Flesh (* https://stackoverflow.com/questions/34929382/what-are-the-differences-between-lwt-async-and-lwt-main-run-on-ocaml-node-js *) let rec run t = @@ -18,11 +19,8 @@ let rec run t = let () = run @@ let domain = "egregore.fun" in - let* stream, push = - Portal.connect domain in - push (Some (Portal.stanza_open domain)); - push (Some Portal.stanza_close); - Lwt_stream.iter - (fun stanza -> - print_endline (">>> " ^ stanza)) - stream + let* stream, push = Stream.start domain + in push (Some (Portal.stanza_open domain)); + let+ opens = Lwt_stream.get stream + in print_endline (Option.get opens); + push (Some (Portal.stanza_close)) |