This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-03
Channels
- # aws (3)
- # babashka (46)
- # bangalore-clj (2)
- # beginners (89)
- # cider (1)
- # clojure (57)
- # clojurescript (4)
- # conjure (6)
- # duct (3)
- # fulcro (2)
- # graalvm-mobile (41)
- # introduce-yourself (1)
- # lsp (12)
- # malli (11)
- # off-topic (37)
- # pathom (3)
- # pedestal (6)
- # podcasts-discuss (5)
- # polylith (17)
- # releases (2)
- # sci (2)
- # shadow-cljs (8)
- # specter (1)
- # tools-deps (10)
I am using the official pedestal web-socket example code.
How do I retrieve the send-ch
when the client closes the connection?
Unfortunately the :on-close
of ws-path
only has a num-code and not the ws-session
and the send-ch
like the :on-connect
https://github.com/pedestal/pedestal/blob/a72c7a274af0e60ba42a18d859f7c6fe9314130e/samples/jetty-web-sockets/src/jetty_web_sockets/service.clj#L61
Hey Fabim
After study a bit the interface, I see that even on jetty we don't have the instance.
I believe that this is because when the close event occours, the Session already do not exists anymore.
For advanced usages, you can take a look at listener-fn
and make-ws-listener
https://github.com/pedestal/pedestal/blob/master/jetty/src/io/pedestal/http/jetty/websockets.clj#L125
@U2J4FRT2T Thanks for your answer.
Since the session is not returned, it’s hard to find the corresponding send-ch
and to close it.
I’m curious if there is a good way of cleaning up the connections at :on-close
(ideally using interceptors).
Other web-socket solutions like chord.http-kit
send a message on close, but I’m not sure how to integrate them in the pedestal ws-routing.