Merge branch 'hs-e36-websocket' into loops/hs
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 17s

This commit is contained in:
2026-04-26 18:31:16 +00:00
16 changed files with 921 additions and 83 deletions

View File

@@ -787,6 +787,31 @@
(quote fn)
(cons (quote me) (map make-symbol params))
(cons (quote do) (map hs-to-sx body)))))))
(define
emit-socket
(fn
(ast)
(let
((name-path (nth ast 1))
(url (nth ast 2))
(timeout-ms (nth ast 3))
(on-msg (nth ast 4)))
(let
((handler
(if
(nil? on-msg)
nil
(let
((body (hs-to-sx (nth on-msg 2))))
(list (quote fn) (list (quote event)) body))))
(json?-val (if (nil? on-msg) false (nth on-msg 1))))
(list
(quote hs-socket-register!)
(cons (quote list) name-path)
url
(if (nil? timeout-ms) nil (hs-to-sx timeout-ms))
handler
json?-val)))))
(fn
(ast)
(cond
@@ -2081,6 +2106,7 @@
(quote _hs-def-val))
(quote _hs-def-val))))))
((= head (quote behavior)) (emit-behavior ast))
((= head (quote socket)) (emit-socket ast))
((= head (quote sx-eval))
(let
((src (nth ast 1)))