Mbus - peer-to-peer message router for linux

v.0.4.1

Content:

Introduction

Mbus offers a place on the internet where messages can be exchanged. The messages can either be part of communication or compute. It solves the problem that it is usually not possible to communicate directly with others because of firewalls (protection) and NAT (subnetting). Therefore we need this place on the internet that everyone can see.

Communication could be chat or direct messaging or just notification of events. Or it could facilitate collaboration on shared news feeds that are instantly fanned out to multiple connections.

With compute one can think of distributed services that are available through the req/res pattern in order to share computational capabilities.

Our design goal was to keep it as small as possible, while fully functional. It only needs ~5MB of resident memory. Although speed was not the objective, because the internet always has a degree of latency, there is fast local access. So at the local level it can even be used for clustering computation. Remote peers can use multiple channels for concurrent operations.

We hope to establish p2p infrastructure using multiple mbus instances.


Using mbus with netcat

On linux (and other unix flavors) it is possible to use mbus with the standard tool for making interactive connections nc. The newsfeed of the public demo by the Digital Post Office can simply be read with this linux command:

nc citiwise.eu 25000

There is no strict need to install anything in order to be able to use a remote mbus. If you wish, you can make multiple connections concurrently. You are automatically subscribed to all channels.

When not interested in any broadcasts, one can run this dot command and press enter:

.unsub

Conversely, if one would only need to read the news feed, on linux one could run this unix command:

nc citiwise.eu 25000 |grep ^10001:

Or if you wish to see all broadcasts except the news feed: Note that you can still send commands, despite the grep.

nc citiwise.eu 25000 |grep -v ^10001:

The idea was that the news feed could be a collaborative effort, but so far there has been no interest at all, so that got shelved for now.

Please see the full list of commands.


Peer services

Peer services can connect or disconnect at will, so in order to see if and on which channel they are available, there is a .whois and a .alias built-in service. On the demo site .whois would show e.g.:

7 {"whois":{"4":"mbox","5":"en-dict"}}

So if one would like to look up a phrase in the English dictionary, one would run the command:

.direct 5 peer

This would send a direct message to the en-dict peer which is on channel 5, in order to get a description of the word "peer."

The Private chat peer service (for linux x64) makes it very easy to chat with someone using a remote mbus instance.

sha256sum: f43376e9b12ae0cd1341e34d386907f88a7626c1d2230fa1e9f40f381abd7a24

The en-dict peer service is available for RaspberryPi, on which it also runs for the demo site.

sha256sum: c674e9697f185d4de0e79ddc824f8b19ad9fa87c96078df7e84893b43506f777


Installing mbus

For linux on x86_64 architecture this binary package is available:

sha256sum: cc75d4d20900e381b03e52ba52626d2aa3235d92d647810c1d71fff27d638db2

Please see the README file for instructions on how to run it. It has no dependencies. It was first released on jan 20, 2025. Currently we are working to also make it available on RaspberryPi, because it is well suitable for being always on.


If you wish to collaborate on this project, please contact me in the fediverse @gert@social.coop. It would be nice if you know something about javascript or linux, or perhaps the C programming language.

The todo list is long and all help would be welcome.

Special thanks to Fabrice Bellard for brilliantly putting asynchronous javascript on top of C with qjs.