Victus Spiritus

home

p2pmsg a distributed message network

02 Feb 2011

Talented socweb hacker Tyler Gillies has been busy late night coding. His latest alpha crafting is a fresh look at communication architectures. p2pmsg is actually a three part peer to peer com system. It's composed of a client or message generator, a receiver (server), and a routing layer which all facilitate communication between nodes.

Client

The client first negotiates a pipe to the router.

It then creates a listening function on the socket which transfers composed messages.

See client.js or client.php for implementation details.

Router

The routing layer is based on Kademlia and is implemented by Telehash.org. The following is a brief description for Kademlia:

Kademlia is a distributed hash table for decentralized peer-to-peer computer networks designed by Petar Maymounkov and David Mazières.[1] It specifies the structure of the network and the exchange of information through node lookups. Kademlia nodes communicate among themselves using UDP. A virtual or overlay network is formed by the participant nodes. Each node is identified by a number or node ID. The node ID serves not only as identification, but the Kademlia algorithm uses the node ID to locate values (usually file hashes or keywords). In fact, the node ID provides a direct map to file hashes and that node stores information on where to obtain the file or resource.

If you're interested in learning more about Kademlia's design, please follow the above wikipedia link. The random neighborhood assignment and choice of exor for a distance-like metric were new to me.

Receiver

The receiver is composed of a database, an http server, a renderer and a socket connection. The minimal receiver is a socket connection, and is similar to the client with the addition of configuring itself as an end point for the Telehash router.

In the test receiver Tyler has coded up he also has a database for storing messages, and an http server with a renderer for serving a view to that data. The full receiver implementation can be found within server.js.

Last I checked Tyler has a live receiving server at nostat.us:8080/tweets (not prettyfied yet). A note of caution: it's bleeding edge alpha, the implementation and server are subject to change. If you run a client you send messages to it as an end point.