n2o_mqtt is an instance of n2o_pi process. In N2O number of such instanses is usually equals to the number of cores.

There is two styles of embedding N2O: one is to perform N2O protocol loop inside connection process (as in cowboy version); second is to spawn ring of n2o_pi processes and handle all requests inside these processes (as in MQTT version). n2o_mqtt is the protocol of such virtual node processes.


On init n2o_mqtt makes connection to MQTT server. On connection established in #mqttc/2 it subscribes to events topic.


After supscription all messages that are being sent to events topic are passed as #publish/2 where n2o_proto:info/3 protocol loop is embedded as handler to that message.

#publish { topic = [] :: binary(), message = [] :: binary()}. #mqttc { client :: pid(), status :: connected }.

All the results go to actions topic:



Service workers start MQTT clients with following config:

[{mqtt,[{host, ""}, {client_id, Gnerated}, {clean_sess, false}, {logger, {console, error}}, {reconnect, 5}]}].

This module may refer to: n2o, n2o_pi, n2o_proto.