diff options
author | Clombrong <clombrong@egregore.fun> | 2025-04-23 17:56:20 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-04-23 17:56:20 +0200 |
commit | 1aa2f2dac32d4289ce95db806589c05ea102503c (patch) | |
tree | 750d17ad43ac412373e5daf770302c34a7b85fcf /test/js | |
parent | 34f072dda231f0de4cfdcd86bfe921fcefc134fb (diff) |
feat: add ws endpoint detection function
Diffstat (limited to 'test/js')
-rw-r--r-- | test/js/websockets_hello.ml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/js/websockets_hello.ml b/test/js/websockets_hello.ml index 41487b7..6b74d96 100644 --- a/test/js/websockets_hello.ml +++ b/test/js/websockets_hello.ml @@ -2,19 +2,19 @@ open Lwt.Syntax let () = (* Echo is a websocket that... echoes you stuff. *) - let stream, push = Portal_ws.lwt_ws "wss://echo.websocket.org" in + let stream, push = Portal_ws.ws_stream "wss://echo.websocket.org" in push (Some "great text"); push (Some "other text"); push (Some "yet another text"); push (Some "BYE"); Lwt.async @@ fun () -> - let+ s = Lwt_stream.iter + let* server = Portal_ws.ws_endpoint "egregore.fun" + in let+ _ = Lwt_stream.iter (fun greetings -> match greetings with (* When the websocket sends "BYE", we close. *) | "BYE" -> print_endline "CLOSING BYE"; push None | hello -> print_endline ("> " ^ hello)) stream - in s - + in print_endline server |