MQ

N2O as EMQ plugin

The N2O over MQTT bridge is a drop-in plugin for EMQ broker. After starting the server you should enable N2O over MQTT bridge EMQ plugin on plugin page http://127.0.0.1:18083/#/plugins and then open the application sample http://127.0.0.1:8000/spa/login.htm

Picture 4. N2O 4.5 MQTT as EMQ Plugin

The nice thing about EMQ is that it enables session introspection for N2O connections. The EMQ Dashboards is written in vue.js and a bit complex for admin application. The possible and expecting hackaton is on rewriting EMQ admin with hyperapp and n2o. The IBM library Paho is also too old and fat to fit N2O sizes. Some parts should be replaced with more modern and compact pinger and connection respawning from n2o.js. This is expecting further research and imporevement.

MQTT versions

EMQ is the latest software that has robust iOS and Android MQTT client libraries, just have a look at https://github.com/emqtt Github organization.

Picture 6. MQTT 3.1.1 vs MQTT 5.0

We made a compatible EMQ plugin and N2O Review sample application with built-in EMQ with minimal dependencies. Our fork is based on the latest EMQ master and is dedicated for building with our MAD build tool.

Listing 6. Setup MQTT flavoured N2O.
$ brew install erlang $ curl -fsSL https://raw.github.com/synrc/mad/master/mad > mad \ && chmod +x mad \ && sudo cp mad /usr/local/bin $ git clone git://github.com/voxoz/mq && cd mq $ time mad dep com Writing /apps/review/ebin/review.app OK real 1m45.357s user 0m17.166s sys 0m5.065s $ mad rep Configuration: [{n2o, [{port,8000}, {app,review}, {pickler,n2o_secret}, {formatter,bert}, {log_modules,config}, {log_level,config}]}, {emq_dashboard, [{listeners_dash, [{http,18083,[{acceptors,4},{max_clients,512}]}]}]}, {emqttd, [{listeners, [{http,8083,[{acceptors,4},{max_clients,512}]}, {tcp,1883,[{acceptors,4},{max_clients,512}]}]}, {sysmon, [{long_gc,false}, {long_schedule,240}, {large_heap,8000000}, {busy_port,false}, {busy_dist_port,true}]}, {session, [{upgrade_qos,off}, {max_inflight,32}, {retry_interval,20}, {max_awaiting_rel,100}, {await_rel_timeout,20}, {enable_stats,off}]}, {queue,[]}, {allow_anonymous,true}, {protocol, [{max_clientid_len,1024},{max_packet_size,64000}]}, {acl_file,"etc/acl.conf"}, {plugins_etc_dir,"etc/plugins/"}, {plugins_loaded_file,"etc/loaded_plugins"}, {pubsub, [{pool_size,8},{by_clientid,true},{async,true}]}]}, {kvs, [{dba,store_mnesia}, {schema,[kvs_user,kvs_acl,kvs_feed,kvs_subscription]}]}] Applications: [kernel,stdlib,gproc,lager_syslog,pbkdf2,asn1,fs,ranch,mnesia, compiler,inets,crypto,syntax_tools,xmerl,gen_logger,esockd, cowlib,goldrush,public_key,lager,ssl,cowboy,mochiweb,emqttd, erlydtl,kvs,mad,emqttc,nitro,rest,sh,syslog,review] Erlang/OTP 19 [erts-8.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] Eshell V8.3 (abort with ^G) starting emqttd on node '[email protected]' Nonexistent: [] Plugins: [{mqtt_plugin,emq_auth_username,"2.1.1", "Authentication with Username/Password",false}, {mqtt_plugin,emq_dashboard,"2.1.1","EMQ Web Dashboard",false}, {mqtt_plugin,emq_modules,"2.1.1","EMQ Modules",false}, {mqtt_plugin,n2o,"4.5-mqtt","N2O Server",false}] Names: [emq_dashboard,n2o] dashboard:http listen on 0.0.0.0:18083 with 4 acceptors. Async Start Attempt {handler,"timer",n2o,system,n2o,[],[]} Proc Init: init mqtt:ws listen on 0.0.0.0:8083 with 4 acceptors. mqtt:tcp listen on 0.0.0.0:1883 with 4 acceptors. emqttd 2.1.1 is running now >

Related Documents