No description, website, or topics provided.
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
python
.gitignore
LICENSE
README.md

README.md

msgp2p is a lightweight messaging system that allows peers located anywhere on the network to exchange messages with each other without any prior knowledge other than an arbitrary long unique identifier assigned to the peer they want to send a message to.

msgp2p is fully distributed and operates without a central server and behind various types of firewalls and NAT devices without the need for the user to configure them nor have knowledge about them.

msgp2p defines a simple paradigm to send messages (strings of characters) to a peer with a given unique id. It also allows to optionally create logical channels so that different information types can be conveyed to an appropriate sub-system of the peer.

In the current state msgp2p uses Bit Torrent Sync as a bearer, so it in fact encapsulates messages into files. The diagram below shows the overall concept. More detailed information is available in the wiki.

Basic Flow

While this satisfies all the original requirements it has the downside of introducing a considerable lag which is, usually, in the order of some tens of seconds. Future releases will address this by removing the reliance on Bit Torrent Sync and implementing a different P2P solution.

msgp2p can be used either as a command in a Linux shell or as a python library to be included in a larger project.

Configuration

Before you can use msgp2p you need to have Bit Torrent Sync running and you need to change the "config" file, which is found in the same folder of the module "msgp2p.py". The config file needs to contain the right parameters for your Bit Torrent service configuration.

Shell Usage

You can use msgp2p as follows to send a message:

msgp2p send address message

To receive:

msgp2p receive address

For instance on one shell you could run:

msgp2p send ADTPPHNFX6U6QIW72P7GYB5CAEOBNN7CM This is a test message

and in another run:

msgp2p receive ADTPPHNFX6U6QIW72P7GYB5CAEOBNN7CM

When the message is received msgp2p will terminate after printing the message content.

Python Usage

You can include msgp2p in your python script and use it to programmatically send and receive messages. An example application that sends and receives messages is included in the "examples" folder.