pedestal

vc 2025-12-03T15:03:11.828149Z

At the risk of sounding ultra noob, can anyone help me how do we send text data back via websockets when on-text handler is called for sure. I am on 0.8.1

rolt 2025-12-11T13:24:23.757429Z

> Whatever value is returned from the :on-open callback is retained, and passed as the second argument to the :on-close, :on-error, :on-text, and :on-binary callbacks. This can be a single value, such as a https://github.com/clojure/core.async/ channel, or a map, or whatever your application needs it to be.

rolt 2025-12-11T13:25:29.634129Z

in the on-open handler, you call start-ws-connection which should give you a channel, that you can then use to send data to the user in the other handlers

rolt 2025-12-11T13:33:57.871029Z

something along those lines:

{:on-open (fn [ws-channel req] (ws/start-ws-connection ws-channel nil))
 :on-text (fn [ws-channel send-ch msg] (println "Received" msg) (a/>!! send-ch "My response"))
 ...}