rupurt
Schoolbus - Manage one or more PubSub instances using the Elixir registry
https://github.com/rupurt/schoolbus
Requires Elixir 1.9+ as it depends on Registry.select/2 to list subscribers
Start the bus
iex(1)> {:ok, _bus} = Schoolbus.start_link([])
{:ok, #PID<0.212.0>}
Register a topic
iex(2)> Schoolbus.register(:games)
:ok
Register a namespaced topic
iex(3)> Schoolbus.register({:songs, :diplo})
:ok
iex(4)> Schoolbus.register({:songs, :tiesto})
:ok
Subscribe to a registered topic
iex(3)> Schoolbus.subscribers()
[]
iex(4)> Schoolbus.subscribe(:games)
{:ok, [:games]}
iex(5)> self()
#PID<0.208.0>
iex(6)> Schoolbus.subscribers()
[games: #PID<0.208.0>]
Subscribe to all topics within a namespace
iex(7)> Schoolbus.subscribers()
[games: #PID<0.208.0>]
iex(8)> Schoolbus.subscribe({:songs, "*"})
{:ok, [songs: :diplo, songs: :tiesto]}
iex(9)> self()
#PID<0.208.0>
iex(10)> Schoolbus.subscribers()
[
{{:songs, :tiesto}, #PID<0.208.0>},
{{:songs, :diplo}, #PID<0.208.0>},
{:games, #PID<0.208.0>}
]
Broadcast a topic to all subscribers
iex(11)> flush
:ok
iex(12)> Schoolbus.broadcast(:games, :uno)
:ok
iex(13)> flush
:uno
:ok
Popular in Announcing
Hey there!
I wrote a download elixir package which does exactly what its name about - an easy way to download files.
I saw solutions ab...
New
The latest release of Ace (0.10.0) includes serving content over HTTP/2.
I have started writing a webserver to teach my self more about...
New
After working on it for a couple of months and using it in production for most of that time, today I’ve released LiveAdmin, a LiveView ba...
New
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub.
Docs are at OpenaiEx User Gu...
New
Hello!
Came here to announce ChromicPDF, a pet project PDF generator I’ve been working on for the past few months. Why another PDF gener...
New
Hello guys,
I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
Image is an image processing library for Elixir. It is based upon the fabulous vix library that provides a libvips wrapper for Elixir.
I...
New
Hey folks!
Want to present a toolkit for writing command-line user interfaces.
It provides a convenient interface for
colorizing text...
New
LiveMotion enables high performance animations declared on the server and run on the client.
As a follow up to my previous thread A libr...
New
Other popular topics
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help.
Where are they similar?
Where do they differ the m...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something…
Haskell reminds me of Java, and e...
New
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








