immutant

http://immutant.org Note: dev discussion happens in #immutant on FreeNode IRC.
renan 2016-06-07T14:33:39.000025Z

@tcrawley: Yes, but I did not make the 'broadcast' in sente .... 😞

2016-06-07T17:39:09.000026Z

@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?

andreas-thoelke 2016-06-07T21:30:21.000028Z

@renan this will do the trick:

andreas-thoelke 2016-06-07T21:31:08.000029Z

(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)))

andreas-thoelke 2016-06-07T21:31:58.000030Z

from http://www.luminusweb.net/docs/websockets.md