Publish-Subscribe in Elixir.
git clone [email protected]:yosriady/pubsub.git
cd pubsub
mix deps.get
mix deps.compile
iex -S mix
iex> Pubsub.subscribe(:test)
{:ok, #PID<0.141.0>}
iex> Pubsub.subscribe(:test)
{:ok, #PID<0.143.0>}
iex> Pubsub.broadcast(:test, "hey")
"hey"
"Got \"hey\" in process #PID<0.141.0>"
"Got \"hey\" in process #PID<0.143.0>"
iex> Pubsub.subscribers(:test)
[#PID<0.141.0>, #PID<0.143.0>]
Pubsub relies on gproc
, which does most of the heavy lifting.