Endpoints
Here is a list of types of endpoints which are supported by EMQ and accesible to N2O apps: WebSockets, MQTT, MQTT-SN, TCP, UDP, CoAP. Normal use of N2O as a Web Framework or a Web Application Server is through WebSockets, but for IoT and MQTT applications it could be served through UDP or SCTP protocols providing application level message delivery consistency. By using MQTT as a transport we extend the supported set of endpoint protocols.
MQTT
EMQ is an open-source MQTT broker implementated by Feng Lee. N2O is EMQ compatible plugin that acts as predefined MQTT clients that form a ring of virtual nodes, process all the protocol requests, and answer to client topics according to classical RPC over MQ schema.
This list of modules forms a core of N2O that is common for both MQTT and WebSocket versions:
$ mad app mqtt review
$ cd review
$ mad dep com pla rep
$ open http://127.0.0.1:8000
WebSocket
COWBOY is small, fast, and modern HTTP server implementated by Loïc Hoguin. In this version, N2O loop is integrated as WebSocket cowboy handler that routes all incoming messages to N2O.
The list of WebSocket specific modules:
- n2o_stream — COWBOY and XHR bridge
- n2o_cowboy — COWBOY API
- n2o_cowboy2 — COWBOY2 API
$ mad app web sample
$ cd sample
$ mad dep com pla rep
$ open http://127.0.0.1:8001/app/index.htm
Protocols
Services
- n2o_session — ETS sessions backend
- n2o_io — IO logger backend
- n2o_secret — AES/CBC-128 encoder/decoder
- n2o_gproc — GPROC MQ backend
- n2o_syn — SYN MQ backend