MqttX.Client.Supervisor (MqttX v0.7.0)

View Source

DynamicSupervisor for managing client connection lifecycles.

Provides supervised client connections with automatic restart on crash. Use MqttX.Client.connect_supervised/1 to start connections under this supervisor.

Example

{:ok, pid} = MqttX.Client.connect_supervised(
  host: "localhost",
  port: 1883,
  client_id: "my_client"
)

# List all supervised connections
MqttX.Client.list()

# Look up by client_id
MqttX.Client.whereis("my_client")

Summary

Functions

Returns a specification to start this module under a supervisor.

Count supervised connections.

Start a supervised client connection.

Stop a supervised client connection.

List supervised connections.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

count()

@spec count() :: map()

Count supervised connections.

start_child(opts)

@spec start_child(keyword()) :: DynamicSupervisor.on_start_child()

Start a supervised client connection.

start_link(opts)

stop_child(pid)

@spec stop_child(pid()) :: :ok | {:error, :not_found}

Stop a supervised client connection.

which_children()

@spec which_children() :: [
  {:undefined, pid() | :restarting, :worker | :supervisor, [module()]}
]

List supervised connections.