JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in
(def server # name it, to close it after (with-dyns [:foo "foo"] (def env (curenv)) # must make a closure, otherwise it will use the fiber's env (net/server "0.0.0.0" 9092 # starts a fiber (fn [conn] # pass the saved env: (fiber/setenv (fiber/current) (table/setproto @{} env)) (:write conn (dyn :foo)) # n.b. stringify if using other :foo value (:close conn)) :stream))) (:read (net/connect "127.0.0.1" 9092) 1024) (:close server)