← Back to all sparks
N

nanonext

ANALYTICS
Velocity2.5

R binding for NNG (Nanomsg Next Gen). Contribute to r-lib/nanonext development by creating an account on GitHub.

nanonext keeps shrinking its build requirements while adding messaging primitives.

async-messagingnnghttp-servermemory-safetywebassembly
Current state
The R binding to NNG ships roughly monthly. Since February the package added an HTTP server that can run synchronously or through the later event loop, a zero-copy device forwarder for building brokers and proxies, and support for pthread-enabled WebAssembly targets. Send operations now move the buffer straight into the NNG message, halving peak memory on serialized sends.
Where it's heading
Two directions run in parallel. One is making the package installable anywhere — the build-time cmake dependency is gone, so compiling bundled NNG and Mbed TLS needs only a C compiler, and WebAssembly targets are supported. The other is raising the ceiling on what can be built on top: device_aio() for message forwarding, an HTTP and WebSocket server with a content map, and stream buffer control. Bug fixes in recent releases concentrate on memory safety in the bundled C sources.
Prediction
Given the pace and the tight coupling declared in each release, expect the next version to track a mirai requirement and continue hardening the HTTP server paths that the last two releases have been leaking memory in.

Recent moves

  1. 9d ago

    Memory leaks and a TLS use-after-free fixed in the HTTP server

    Closes two memory leaks in http_server() — unfreed handlers at teardown and streaming connections never releasing request objects — plus a use-after-free when an HTTPS request times out during the TLS handshake. These matter to anyone running the server for more than a short session.

    View source ↗
  2. 1mo ago

    Event-loop integration for HTTP and WebSocket callbacks

    Adds run_event_loop() so HTTP and WebSocket server callbacks can be processed on R's main thread through the later event loop. It completes the server story started by the synchronous $serve() method two releases earlier.

    View source ↗
  3. 1mo ago

    Zero-copy message forwarding, and cmake dropped from the build

    ⚡ SPARK

    Adds device_aio(), a zero-copy asynchronous forwarder between two sockets for building brokers and proxies, and drops the cmake build-time dependency so bundled sources compile with only a C compiler. It also fixes character-vector round-tripping that was dropping empty strings.

    View source ↗
  4. 2mo ago

    Builds against pthread-enabled WebAssembly targets

    Adds support for building against pthread-enabled WebAssembly targets such as a pthread variant of webR, updates the bundled NNG source, and drops support for mirai below 2.7.0. The WebAssembly work extends where the package can run rather than what it does.

    View source ↗
  5. 3mo ago

    Serialized sends drop a copy and halve peak memory

    Serialized sends now transfer the buffer directly into the NNG message, removing a copy and halving peak memory, and messages larger than INT_MAX bytes are fixed over TCP and IPC on macOS and Windows. It also broadens the HTTP server content map and retires messenger().

    View source ↗
  6. 4mo ago

    Blocking HTTP server mode and stream buffer sizing

    Adds a $serve() method for running an http_server() in blocking mode and a buffer argument on stream() for receive buffer sizing, deprecating the older n argument on recv(). The first half of the HTTP server work that run_event_loop() later completes.

    View source ↗