MQTT v0.2.2 MQTT.Client behaviour View Source

A behaviour module for implementing an MQTT client.

Link to this section Summary

Link to this section Types

Link to this type action() View Source
action() ::
  {:publish, topic :: String.t(), message :: iodata()} |
  {:publish, topic :: String.t(), message :: iodata(), %{optional(:qos) => :mqtt_packet.qos(), optional(:retain) => boolean()}} |
  {:reply, :gen_statem.from(), term()}
Link to this type start_options() View Source
start_options() :: %{transport: {:tcp, map()} | {:ssl, map()}, keep_alive: non_neg_integer(), protocol: iodata(), username: iodata(), password: iodata(), client_id: iodata(), clean_session: boolean(), last_will: %{topic: iodata(), message: iodata(), qos: :mqtt_packet.qos(), retain: boolean()}}

Link to this section Functions

Link to this function start_link(module, args, options) View Source
start_link(module(), any(), start_options()) :: {:ok, pid()}
Link to this function start_link(name, module, args, options) View Source
start_link(:gen.emgr_name(), module(), any(), start_options()) :: {:ok, pid()}

Link to this section Callbacks

Link to this callback code_change(oldVsn, oldState, extra) View Source
code_change(oldVsn :: term() | {:down, term()}, oldState :: any(), extra :: term()) ::
  {:ok, new_state :: any()} |
  term()
Link to this callback handle_call(call, from, state) View Source
handle_call(call :: any(), from :: :gen_statem.from(), state :: any()) ::
  {:ok, state :: any()} |
  {:ok, state :: any(), action() | [action()]} |
  {:stop, reason :: term()}
Link to this callback handle_cast(cast, state) View Source
handle_cast(cast :: any(), state :: any()) ::
  {:ok, state :: any()} |
  {:ok, state :: any(), action() | [action()]} |
  {:stop, reason :: term()}
Link to this callback handle_connect(session_present, state) View Source
handle_connect(session_present :: boolean(), state :: any()) ::
  {:ok, state :: any()} |
  {:ok, state :: any(), action() | [action()]} |
  {:stop, reason :: term()}
Link to this callback handle_connect_error(reason, state) View Source
handle_connect_error(reason :: term(), state :: any()) ::
  {:reconnect, {:backoff, min :: non_neg_integer(), max :: pos_integer()}, state :: any()} |
  {:stop, reason :: term()}
Link to this callback handle_disconnect(reason, state) View Source
handle_disconnect(reason :: term(), state :: any()) ::
  {:reconnect, {:backoff, min :: non_neg_integer(), max :: pos_integer()}, state :: any()} |
  {:stop, reason :: term()}
Link to this callback handle_info(info, state) View Source
handle_info(info :: any(), state :: any()) ::
  {:ok, state :: any()} |
  {:ok, state :: any(), action() | [action()]} |
  {:stop, reason :: term()}
Link to this callback handle_publish(topic, message, state) View Source
handle_publish(topic :: binary(), message :: binary(), state :: any()) ::
  {:ok, state :: any()} |
  {:ok, state :: any(), action() | [action()]} |
  {:stop, reason :: term()}
Link to this callback handle_subscribe_result(topic, arg1, state) View Source
handle_subscribe_result(topic :: binary(), :mqtt_packet.qos() | :failed, state :: any()) ::
  {:ok, state :: any()} |
  {:ok, state :: any(), action() | [action()]} |
  {:stop, reason :: term()}
Link to this callback init(args) View Source
init(args :: any()) ::
  {:ok, state :: any()} |
  {:stop, reason :: term()}
Link to this callback terminate(arg0, state) View Source
terminate(:normal | :shutdown | {:shutdown, term()} | term(), state :: any()) :: any()