(def news (chan 1))
(def shouter (pub news :topics))
(def alice (chan 1))
(def bob (chan 1))
(def clyde (chan 1))
(sub shouter :celebrity-gossip alice)
(sub shouter :space-x bob)
(sub shouter :space-x clyde)
(go-loop [heard (<! alice)] (println "alice heard: " heard))
(go-loop [heard (<! bob)] (println "bob heard: " heard))
(go-loop [heard (<! clyde)] (println "clyde heard: " heard))
(put! news {:topics :celebrity-gossip :data "omg she's prego!"})
(put! news {:topics :space-x :data "omg we're landing!"})
; notice: they both "heard" the space-x news
; Also, since I'm a bit new to `async`, I'm not sure on this:
; There seems to be some issues with bob only hearing when clyde is listening.
; not sure what's up.