View Source PintBroker (PintBroker 🍺 v1.0.1)

A simple, pint-sized MQTT broker that can be used for testing and development

See the README for more information on usage, features, and configuration

Summary

Functions

Add a topic filter rule with handler

Returns a specification to start this module under a supervisor.

Publish a message to a topic.

Start and link a PintBroker

Types

@type opt() ::
  {:port, :inet.port_number()}
  | {:name, GenServer.name()}
  | {:overrides, :gen_tcp.option()}
  | {:rules, [rule()]}
  | {:on_connect, (client_id :: String.t() -> :ok)}
  | {:on_disconnect, (client_id :: String.t() -> :ok)}
@type rule() ::
  {Tortoise311.topic_filter(),
   pid()
   | (Tortoise311.Package.Publish.t() -> any())
   | (Tortoise311.topic(), Tortoise311.payload() -> any())}

Functions

Link to this function

add_rule(server \\ __MODULE__, topic, handler)

View Source
@spec add_rule(GenServer.server(), Tortoise311.topic_filter(), pid() | function()) ::
  :ok

Add a topic filter rule with handler

See Rule forwarding for more info

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

publish(server \\ __MODULE__, topic, payload)

View Source

Publish a message to a topic.

@spec start_link([opt()]) :: GenServer.on_start()

Start and link a PintBroker

See PintBroker.opt() and Configuration for more info about configuring the broker