Skip to content

yosriady/pubsub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pubsub

Publish-Subscribe in Elixir.

Setup

git clone [email protected]:yosriady/pubsub.git
cd pubsub
mix deps.get
mix deps.compile
iex -S mix

Try it

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>]

Reference

Pubsub relies on gproc, which does most of the heavy lifting.

Full gproc API Reference

GProc - Erlang Global Process Registry

Releases

No releases published

Packages

No packages published

Languages