tortoise v0.8.1 Tortoise.Connection View Source

Establish a connection to a MQTT broker.

Todo.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

Close the connection to the broker

Start a connection process and link it to the current process

Return the list of subscribed topics

Link to this section Types

Link to this type client_id() View Source
client_id() :: binary() | atom()

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function disconnect(client_id) View Source
disconnect(client_id()) :: :ok

Close the connection to the broker.

Given the client_id of a running connection it will cancel the inflight messages and send the proper disconnect message to the broker. The session will get terminated on the server.

Link to this function start_link(connection_opts, opts \\ []) View Source
start_link(connection_options, GenServer.options()) :: GenServer.on_start()
when connection_option:
       {:client_id, String.t() | atom()}
       | {:user_name, String.t()}
       | {:password, String.t()}
       | {:keep_alive, pos_integer()}
       | {:will, Tortoise.Package.Publish.t()}
       | {:subscriptions, [{String.t(), 0..2}] | Tortoise.Package.Subscribe.t()}
       | {:handler, {atom(), term()}},
     connection_options: [connection_option]

Start a connection process and link it to the current process.

Read the documentation on child_spec/1 if you want… (todo!)

Link to this function subscriptions(client_id) View Source
subscriptions(client_id()) :: Tortoise.Package.Subscribe.t()

Return the list of subscribed topics.

Given the client_id of a running connection return its current subscriptions. This is helpful in a debugging situation.