I’d like to introduce you to my latest project XMPP-FTW. The name is a (hopefully) clever play on “For The Win” (FTW) but actually I call it “XMPP For The Web”.
Essentially XMPP-FTW tries to make XMPP in the browser as quick and painless as many of the other solutions for realtime web by translating XML to JSON and back and using named events to help fill in the missing pieces.
I’ve attended a couple of XSF summits now and both times there’s been both hushed whispers and open talks about the need for some sort of JSON interface for XMPP in order to drive adoption with web developers.
The problem is that most web developers experiences with XML haven’t been great and its also relatively slow to work with in the browser. The solution to this is to give developers a data in a format they are comfortable with, and on the web this is JSON.
Several of the discussions centred around how to achieve this. Do we throw away the XML of XMPP and switch wholesale to JSON? Do we support a subset of XMPP in JSON? Do we write some super awesome translator that can consistently and accurately map between JSON and XML?
During the 2013 summit in Brussels after one of these discussions I decided to start hacking something together in nodejs with socket.io providing the transport to the browser. Within an hour I had something workable and was able to send messages and set presence, which was really cool. Little known to me Lance Stout from &yet; had already started working on something similar but coming at it from the other direction, building the XML to JSON part. We smushed the projects together and this became the beginnings of stanza.io.
After returning from the XSF summit and FOSDEM feeling inspired I continued to hack on my original version of the project to see where I could take it. Since then I’ve done a couple of rewrites of the core code and built something that I’m now beginning to feel happy with.
The goals of the project are to make XMPP as easy as possible for front-end developers to integrate into their applications and to also save them continuously reinventing the wheel with their own realtime chat and pubsub implementations. Implementations which will solve the same problems, but are silo’d or require a lot of effort should they want to share/spread data in the future (why make work for yourself?).
In the words of Peter St Andre….
Federate or die
Most of the work building XMPP-FTW goes into scratching my head thinking of how to make XMPP as easy as possible whilst retaining the power of the system whilst also trying to keep things consistent and future-proof too.
My development process involves extending the manual with the new messages and then implementing that feature. I then test this against my own (and other) XMPP servers using the demo client, see what works and what doesn’t and slowly improve. As each tiny section is ready I push up to github and then this is automatically pushed to the server if everything is ok.
I have a logo, and I think its great. I essentially typed ‘xmpp-ftw’ into google image search and this ugly, but cute, little creature popped up. Its a baby aardvark and I think its awesome!
Where am I?
Currently I’m happy with the basic setup of XMPP-FTW. I’ve got basic presence, chat, MUC, roster, and data forms all working properly and APIs are fairly stable. I still need to deal with some issues such as client errors and getting a unit testing setup in place (all code is crap without unit tests).
Next up is service discovery and pub-sub. Pub-sub is going to be the biggest module of the project so far, but its something I’m very excited to get going (it also means I can extend it for buddycloud work in the future too).
After that I’ll begin adding more of the extensions and then go back over everything to ensure performance is all it can be (its very fast at the moment anyway).
I’ll also ensure that I have very good developer documentation so people are able to extend (and contribute if they wish) for their own purposes.
When I first started the project I created a chat client to demonstrate the use of XMPP-FTW in the browser. This had two disadvantages:
- It was a pain to keep up to date with new features/changes
- It didn’t really show the developer/user what messages were going back and forth
In order to solve these problems I created, what I consider, an awesome new demo client which someone who has never used XMPP, or potentially is not even a developer could quite easily use and work with.
I’ve written a separate blog post about this and you can find it at “New demo system for XMPP-FTW“.
If the build is successful the code is then pushed to the servers at nodejitsu. Its currently costing me a stupidly small amount of money $3/month to run the service and hopefully as part of nodejitsu’s free hosting for open source projects it’ll be totally free soon too. Can not express the ♥ for using nodejitsu’s service.
I’m keeping as a high a pace on this project as possible whilst I have the momentum and the drive to do it. I’m seeing a steady growth in visitors to the nodejitsu site which is encouraging. I feel I need to implement a few more features and then aim to create some example chat clients on a stable API.
Additionally the code is available via npm under the module name ‘xmpp-ftw‘, it may be slightly behind the times but I aim to keep this as up to date as possible.
I think this would be a really cool thing to do, so I’m putting this down as a challenge to any front-end developers building web applications built on XMPP.
Have you heard of the 15-minute blog challenge?
Well what if we did a 15 minute XMPP chat client challenge? Only the basics: login, presence, roster, single user chat, multi-user chat, add users to roster, logout.
If you are interested in giving this a go it would be cool to see some posts on the subject and some working code. I can give you access to an XMPP server to play with if required.
XMPP-FTW is a nodejs server which sits between your XMPP server and the browser and makes using XMPP quick, easy, and fast by translating XMPP to JSON (and back again) and using named events to fill in the missing pieces. Its available to play with on nodejitsu (https://xmpp-ftw.jit.su) and the code is available on github (https://github.com/lloydwatkin/xmpp-ftw)
Leave a Reply
You must be logged in to post a comment.