Narwhal: An extensible pub/sub messaging server for edge applications

hi there! i’ve been working on a project called Narwhal, and I wanted to share it with the community to get some valuable feedback:

https://github.com/narwhal-io/narwhal

what is it? Narwhal is a lightweight Pub/Sub server and protocol designed specifically for edge applications. while there are great tools out there like NATS or MQTT, i wanted to build something that prioritizes customization and extensibility. my goal was to create a system where developers can easily adapt the routing logic or message handling pipeline to fit specific edge use cases, without fighting the server's defaults.

why Rust? i chose Rust because i needed a low memory footprint to run efficiently on edge devices (like Raspberry Pis or small gateways), and also because I have a personal vendetta against Garbage Collection pauses. :slight_smile:

current status: it is currently in Alpha. it works for basic pub/sub patterns, but I’d like to start working on persistence support soon (so messages survive restarts or network partitions).

i’d love for you to take a look at the code! i’m particularly interested in all kind of feedback regarding any improvements i may have overlooked.

1 Like

Very interesting. Many years ago we used XMPP at one company to communicate with edge units. The term IoT had not been invented at that time. At another company we used MQTT. Now at a third they are using NATS.

So far NATS has been the easiest to deal with but I have often got the feeling things are getting more complex and heavy weight than we need. NATS was not really designed for IoT, neither was XMPP.

I have been waiting for a Rust solution. Perhaps yours....

Just now there is a drive in my company to use NATS over web sockets. Is that in the picture for Narwhal?

1 Like

A Rust pub/sub :

thanks for sharing that context!

that specific feeling, that existing tools are becoming heavier and more complex than necessary for the edge, is actually the main reason I started building Narwhal. :slightly_smiling_face:

I wanted to get back to something lightweight that fits that specific niche without the extra baggage.

regarding WebSockets: yes, absolutely. a WS transport layer is definitely on the roadmap and is something i've already considered, though to be honest, it hasn't been prioritized just yet (as i focused first on the core TCP protocol), but it is 100% in the picture for the future.