N2O is a embeddable message protocol loop library for WebSocket, HTTP, MQTT and TCP servers. It provides basic features, such as: process management; virtual nodes ring for request processing; session, encoding, mq, cache and log services. It also includes poor man's bridges to server's endpoints.
- Purpose: High performance protocol relay
- Endpoints: WebSockets, MQTT, TCP
- Codebase: 1K LOC (Erlang), 500 LOC (JavaScript)
- Buildtools: REBAR, MAD
- Templates: DTL, NITRO
- Hosts: COWBOY, EMQ, MOCHIWEB
- Samples: REVIEW (1), SAMPLE (2)
N2O was created to bring clarity and sanity to software development. The distribution model is per file basis with ISC license.
The core modules provide OTP start and N2O entry point.
MQTT version is implemented as RPC over MQ pattern. N2O service worker started as ring of virtual nodes each runs N2O loop.
$ mad app mqtt review
$ cd review
$ mad dep com pla rep
$ open http://127.0.0.1:8000
N2O Loop is directly connected and runned inside context of WebSocket handler.
Usually in Erlang we use syn
or gproc
OTP message buses.
As such buses are optional in MQTT setup we include bus drivers in WebSocket package.
- n2o_stream — COWBOY and XHR bridge
- n2o_heart — PING protocol
- n2o_cowboy — COWBOY API
- n2o_cowboy2 — COWBOY 2 API
- n2o_gproc — GPROC bus backend
- n2o_syn — SYN bus backend
$ mad app web sample
$ cd sample
$ mad dep com pla rep
$ open http://127.0.0.1:8001/app/index.htm
N2O is shipped with 3 protocols, which could be omited or extended.
- n2o_nitro — N2O Nitrogen web framework protocol
- n2o_ftp — N2O File protocol
- n2p_heart — N2O Heart protocol
Formatters, Loggers, Sessions, etc. Optional.
- n2o_bert — BERT encoder/decoder
- n2o_json — JSON encoder/decoder
- n2o_secret — AES/CBC-128 encoder/decoder
- n2o_session — ETS session backend
- n2o_io — IO loger backend
- bert.js — BERT encoder/decoder
- utf8.js — UTF8 encoder/decoder
- ieee754.js — IEEE754 encoder/decoder
- heart.js — HEART protocol
- nitro.js — NITRO protocol
- ftp.js — FTP protocol
- n2o.js — N2O protocol looper
- mq.js — MQTT client
- N2O Book PDF