Flux MQTT

An interface to connect to MQTT broker, sending and handling messages.

It uses Tortoise, check their documentation to understand how this library perform the configuration, handling, and delivery of MQTT messages.

Usage

Add Flux MQTT as a dependency in your mix.exs file:

def deps do
  [{:flux_mqtt, "~> 0.0.3"}]
end

FluxMQTT describes how to define a connection specification and how to send a message.

FluxMQTT.Handler describes how to handle MQTT messages defined in a connection.

Application Configuration

import Config

# Default values
config :flux_mqtt,
  broker: [
    host: "emq",
    port: 1883
  ],
  client: [
    name: "client",
    auth: [
      authenticate?: true,
      username: "client",
      password: "password"
    ],
    correlation: [
      create_correlation_id?: true,
      base: 36,
      length: 8,
      as: :suffix,
      separator: "_"
    ]
  ],
  initial_state: [],
  topics: []

Configuration Options