@tcrawley: Yes, but I did not make the 'broadcast' in sente .... 😞
@renan: you could keep a global atom of {user ws-connection}
that you update from :on-open/:on-close
, and then send!
to each value in that map. would that work?
@renan this will do the trick:
(def websocket-callbacks
{:on-open connect!
:on-message notify-clients!})
(defonce channels (atom #{}))
(defn connect! [channel]
(swap! channels conj channel))
(defn notify-clients! [_ msg]
(doseq [channel @channels]
(async/send! channel msg)))