By Patrick Williams – Developer at BitTorrent Inc./µTorrent
Live chat has been around since almost the dawn of the Internet. All you need is two people and a central server, and you’re connected. Until now.
You don’t need a server.
Last week, in tandem with the µTorrent 3.0 launch, we released my new app called µChat. It’s a simple idea, one that builds on the philosophy upon which BitTorrent was built. Distributed technologies are in our DNA.
For some time, our (always passionate) users have been asking for functionality in the µTorrent client to chat with people in a swarm. Some were looking for community-based tech support and product tips, others simply wanted to thank the seeders. It would’ve been easy for us to simply plug in a third-party chat app into the client and call it a day. But that isn’t in our DNA either.
There was one problem – chat functionality wasn’t on our immediate development roadmap. Luckily, BitTorrent encourages engineers to be independently creative and innovative. And so I decided to challenge myself with a side project: find a way to use P2P technologies to enable chat without the need for a server.
From the beginning, I knew our community already had awesome building blocks in the form of torrents and magnet links. Plus, our Apps platform would give me the ability to build an independent system that would install seamlessly with µTorrent without distracting from core functionality.
It was just a matter of architecting a system that would enable peers to chat in a group setting without servers. There were three main obstacles to tackle: connecting peers, a central place to find rooms, and buddy lists.
Magnet links are the biggest key to knocking down the first barrier. Virtually every piece of functionality in µChat uses magnet links in one way or another. For example, every room you join is a magnet link, and the peers you see in the rooms are fellow swarm peers. Except I pulled a fast one on µTorrent. You’re not actually downloading anything (and the peers don’t disconnect because we’ve coded them to be very optimistic about their future chances of getting the torrent file). That all worked well, except we still needed a way to find rooms, and we didn’t have a buddy list. Two obstacles left…
Next, I needed to find a central place for users to find chat rooms. Upon launch, µChat client joins a giant predetermined swarm. We’ve seen swarms in the wild that are absolutely massive, so it is a reliable way to get all the peers together to exchange information about available rooms. µChat clients actually inform each other about rooms.
Lastly, no chat function is complete without the ability to keep track and reconnect with your friends. So the buddy list is my favorite. In the real world no one knows all your friends. Just you. And when you introduce yourself, you can say whatever you want. I think that’s a pretty good setup, and so with µChat, your buddy list is known only to you, and you can call yourself whatever you’d like. When you become friends with someone else, you both add the same unique magnet link so that you can find each other later simply by joining that swarm. We also implemented a level of crypto to verify the friend. So instead of both your information persisting on a server, a friendship on µChat is simply a common swarm, your friend’s public key, and their original name (because sometimes a contact may have changed their chat name).
That’s µChat in a nutshell: simply a way to make and keep relationships with people around the world with no central server. And while another chat client is probably not going to rev the tech world’s engines, the possibilities created by the underlying technology are pretty exciting. And the underlying tech that makes this all work is already finding it’s way into my next side project…