Home

GitHub Workflow Status Site

Pronounced neigh-lon.

A bidirectional communication protocol that can be used over raw sockets, WebSockets or any other method of transmission.

Its main use case is situations where you have a transport layer without any structure, e.g. TCP sockets where you stream arbitrary bytes. The role of nlon here is to provide a convenient layer on top of the transport to give shape to the data being transmitted.

This repository includes the protocol specification and a reference implementation in JavaScript.

Features

  • ๐Ÿ“ฆ Almost no dependencies
    • The core uses 3 dependencies: pino, nanoid, ndjson
  • ๐Ÿ”ฉ Protocol-agnostic
    • Works the same over TCP as WebSockets by using Adapters
  • โšก Simple specification
    • The whole spec is a ~5 min read
  • ๐ŸŽ‰ Express-inspired API for writing Servers
    • Register (route) handlers to respond to incoming messages
  • ๐Ÿ“จ Streaming supported by design
    • Protocol permits transmitting data in multiple chunks

Adapters

Install

  • pnpm: pnpm add @elementbound/nlon
  • npm: npm i @elementbound/nlon
  • yarn: yarn add @elementbound/nlon

Usage

See the reference implementation.

Documentation

License

This package is under the MIT License.

results matching ""

    No results matching ""