Poolder.PubSub (Poolder v0.1.16)

View Source

ETS-based public PubSub, identified by a logical server.

  • server is the name you pass to start_link/1
  • Internally, the ETS table is registered in :persistent_term with key {:pubsub, server}
  • All functions receive the server as the first argument and resolve the ETS from there

Summary

Types

server()

@type server() :: atom()

table()

@type table() :: atom()

Functions

broadcast(server, regex, payload)

broadcast_from(server, pid, topic, payload)

list_all(server)

list_topics(server, pid)

list_topics_all(server)

start_link(server, opts \\ [])

Starts a PubSub server named server and creates the public ETS.

Options:

  • :table => ETS name (by default uses :"#{server}_pubsub")

stop(server)

subscribe(server, topic, pid \\ self())

subscribers(server, topic)

unsubscribe(server, topic, pid \\ self())