Packages

Elixir wrapper for the emqttc library. Some of the features: Reconnection, offline queueing, gen_* like callback APIs, QoS 0-2.

Current section

Files

Jump to
exmqttc lib exmqttc_test_client.ex
Raw

lib/exmqttc_test_client.ex

defmodule Exmqttc.Testclient do
@moduledoc false
def init do
{:ok, []}
end
def handle_connect(state) do
send(:testclient, :connected)
{:ok, state}
end
def handle_disconnect(state) do
send(:testclient, :disconnected)
{:ok, state}
end
def handle_publish("reply_topic", payload, state) do
send(:testclient, {:publish, "reply_topic", payload})
{:reply, "foobar", "testmessage", state}
end
def handle_publish(topic, payload, state) do
send(:testclient, {:publish, topic, payload})
{:ok, state}
end
def handle_call(:test, _from, state) do
send(:testclient, :test_call)
{:ok, state}
end
def handle_cast(:test, state) do
send(:testclient, :test_cast)
{:ok, state}
end
def handle_info(:test, state) do
send(:testclient, :test_info)
{:ok, state}
end
end