Skip to content

synrc/n2o

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Feb 9, 2025
d07cd15 · Feb 9, 2025
Sep 6, 2024
Aug 28, 2019
Nov 18, 2022
Mar 3, 2023
Jul 2, 2022
Nov 22, 2022
Mar 24, 2023
Nov 4, 2021
Feb 28, 2021
Feb 4, 2021
Apr 16, 2021
Oct 26, 2020
Nov 6, 2019
Jul 2, 2022
Jul 2, 2022
Jul 2, 2022
Jun 25, 2022
Feb 9, 2025
Dec 5, 2021
Sep 6, 2024
Nov 4, 2021
Nov 17, 2020

Repository files navigation

N2O: TCP MQTT WebSocket

Actions Status Hex pm

N2O is an 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, sessions, frame encoding, and unified API for external mq and caching services.

Core Features

  • Purpose: High performance protocol relay
  • Endpoints: WebSockets, MQTT, TCP
  • Codebase: 700 LOC (Erlang), 500 LOC (JavaScript)
  • Dialyzer: REBAR, REBAR3, MAD, MIX
  • Hosts: BANDIT, COWBOY, EMQ, MOCHIWEB, RING, TCP, UDP
  • PubSub: GPROC, SYN, PG2
  • Formatters: JSON, BERT, ASN.1

Protocol Extensions

  • Templates: DTL, NITRO
  • Abstract Database Layer KVS: FS, MNESIA, ROCKSDB, RIAK, REDIS
  • Business Processes: BPE (BPMN 2.0), SCM, ERP, CRM
  • HTTP API: REST (proplist/JSON)
  • ACTIVE Reloading: GNU/Linux, Windows, macOS

Basic Samples

Enterprise Samples

  • Online Client Bank: BANK (8041)
  • Instant Messaging: CHAT (8042)
  • Product Lifecycle Management: PLM (8043)

Motivation

N2O was created to bring clarity and sanity to software development. The distribution model is per file basis with ISC license.

Kernel

The core modules provide OTP start and N2O entry point.

WebSocket

N2O Loop is directly connected and ran 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.

git clone [email protected]:synrc/sample && cd sample
rebar3 shell
open open http://localhost:8001/app/login.htm

Protocols

N2O ships with 3 optional protocols.

Services

Formatters, Sessions, etc. Optional.

JavaScript

Literature

  • "N2O: no bullshit sane framework for wild web" PDF (versions 0.11—4.4)
  • "N2O BOOK Vol.2 Green Book" HTML (versions 4.5—9.11)