I’ve tried multiple mqtt clients and almost no one has ssl client support except exmqtt that wraps emqttc, using that I’ve tried to connect to aws iot using:
however none of the connect/disconnect callbacks are called. My callbacks module is:
defmodule MqttClient do
require Logger
use Exmqttc.Callback
def init(_params) do
{:ok, []}
end
def handle_connect(state) do
Logger.debug "Connected"
{:ok, state}
end
def handle_disconnect(state) do
Logger.debug "Disconnected"
{:ok, state}
end
def handle_publish(topic, payload, state) do
Logger.debug "Message received on topic #{topic} with payload #{payload}"
{:ok, state}
end
end
does someone have any idea? Is my elixir config correct? (specially the ssl part which I’m not sure is the right elixir counterpart of the erlang code)
I haven’t tried connecting to a amazon hosted MQTT server, but I do have a client called Tortoise, and it does support SSL. Currently it lacks documentation, and I am about to write some; have you tried it? What’s your experience? Where should I focus in the documentation?
Thanks for the reply, I went through tortoise but without any doc and since I was in a hurry I’ve just used gen_mqtt (which is also yours ) with mosquitto which bridges the client to AWS IOT.
Btw regarding documentation a non-ssl/ssl and an handler example (just saw that in the tests) would be more than enough!
Awesome. Perhaps I should write a macro that will make implementing a Tortoise.Handler easier with default implementations for most of the callbacks. Currently I am making an attempt to improve the documentation for Tortoise over at this pull request:
I red the documentation but I didn’t manage to do the SSL connection with Tortoise. Could you please explain about the options? cacertfile, key, cert. Is it a path? Is it a string of what file contains? what is it ? I couldn’t find documentation for this.
Not yet; but hopefully I can get to work on Tortoise at some point in the near future. Sorry I have been away for a long while. Feel free to check out other options. The MQTT 5 version of Tortoise will have a different interface than the one that worked for MQTT 3.1.1, so if you have something working already a slight rewrite of your MQTT parts will be required anyways.