Experimenting With Telepathy Tubes

During Akademy Daniele Domenichelli and I held a workshop on Telepathy Tubes and how they can be integrated in your application.

What is a Telepathy Tube

In Telepathy, a tube is a method of sending arbitrary data between two contacts over the XMPP stream. This is abstracted to the developer in the form of a local TCP socket or a separate Dbus session between the two computers. This allows you to set up a network connection without having to worry about all the difficulties of IP addresses, firewalls, routing and NATs.

In simple terms, it allows you to exchange more stuff with a contact than the normal text, files or video traditionally associated with instant messaging.

Fun and Games

After the workshop Daniele and I decided to try and add Telepathy tubes to an existing KDE application, in this case KBattleship.

We added a button to the main menu such that instead of starting a game by having to manually type in hostnames and port numbers we simply select a contact from the menu. Considerably easier!

From here we simply select the contact, and all the network setup is handled in the background.

I then lose dramatically.

Having a Go

I don't expect this to be merged into KDE Games anytime soon, we need to get our internal libraries complete and stable. This was just a fun hacking project rather than anything serious.

We need the latest kdegames libs

svn co -N svn://anonsvn.kde.org/home/kde/trunk/KDE/kdegames
cd kdegames && svn up cmake libkdegames libkmahjongg
cmakekde

and my patched version of kbattleship.

git clone git://anongit.kde.org/scratch/davidedmundson/kbattleship.git

If you have it installed, let us know.. maybe we can have a game 😀

Moving Forward

This was primarily just a demo to see how quickly we can hack Telepathy into an existing application that has network support. It took us less than 3 hours to have something working.

There are far more practical, exciting uses and it would be really good to see more people make use of this. If anyone is inspired and wants to hack on something cool, come talk to us on #kde-telepathy on freenode.

Leave a Reply

Your email address will not be published. Required fields are marked *