Have you ever wondered if it would be possible to create a peer to peer (P2P) network using nothing but WordPress?
It may seem a little odd but I cannot get this idea out of my head. Would it be possible to have separate WordPress installations, discover and share content between each other? If it is possible, would it be useful? and how might it be achieved?
My idea is to release a WordPress plugin (WP2P) that provides the core functionality for a P2P environment. It will allow other plugins and themes to register their own payloads to be shared on the network. The WP2P core will consist of two key components:
Most P2P networks seem to require a tracker to aid with client discovery. The job of the tracker is to be the first port of call for any new client on the network. In a WordPress environment it would keep track of the URLs of WordPress installations already in the swarm and share them with new sites that join the WP2P network.
Once the tracker has introduced the new client to the pool of clients it takes a back seat and the clients can begin to function independently. A client and tracker may communicate from time to time to ensure the tracker has an up to date list of active WordPress installations in the swarm.
I see this functionality being built on top of the XML-RPC API that already exisits in WordPress. This API takes care of remote authentication which would allow for both private and public trackers. Private trackers would require a login to join the swarm, whilst the public trackers (providing you have the tracker URL) would be open to anyone.
Once a client has been introduced by the tracker, it would need to ask around for a list of available payloads and clients from each other client in the network. It would most likely use WP-Cron and XML-RPC to make remote requests fairly frequently (I cannot see another way in PHP). This approach should result in clients discovering and sharing data autonomously.
The site administrator will be able to opt in and out of the available payloads from within the WordPress admin. This will be especially important when using a public tracker for security reason. You would need to be vary cautious about what is downloaded and shared. Keeping this environment secure would have to be very high priority and something to investigate.
It’s about now that your probably wondering if I have lost my mind and you would be right in asking… what are we going to use this crazy bit of kit for?
There are some fairly obvious use cases for this technology. Creating a number of website mirrors would be my first thought and sharing media library assets could be very handy too. In fact WordPress already has a rather interesting function that allows side loading media from other locations: wp_handle_sideload.
Beyond the obvious, here is another powerful idea. Decentralising content. WordPress is developed as a community so perhaps our content can be too?
Lets say your a DJ in London and you run an events website. It turns out there are already another three websites promoting different DJ events and it would be great if you all got together and shared your events. If your all using WordPress and WP2P, you could automatically share each others events at the touch of a button. No one site owns the content, but all sites benefit from the shared publicity. I am sure we could even work out a way to get around the SEO issue of duplicate content.
Most of all, I am hoping it would strengthen the web. Sites would be harder to censor and more resilient to attack. Knowledge would remain free and ideas can continue to be shared… and with the ability to register your own payloads you could invent crazy new ideas of your own.
But It Will Not Work!
I would love to hear why (you can reach me on twitter). My background is as a designer and whilst I am a fairly proficient coder these days, I am far from a P2P or network expert.
If you love the idea, I would like to hear from you too. I have created an empty GitHub repository and would welcome contributions, questions and everything in-between. If WP2P gets enough interest I may even seek to crowd fund the idea (but that is for another day).
Have you ever wondered if it would be possible to create a peer to peer (P2P) network using nothing but WordPress? Now you have!