Lloyd Watkin
lloyd@evilprofessor.co.uk ::: @lloydwatkin

Quick poll

Who knows what XMPP is?

Who has used XMPP?

Who uses XMPP?

Who runs their own server?


What is XMPP?

eXtensible Messaging and Presence Protocol
(aka Jabber)

Started around 1998
Became part of IETF in 2002

Think you don't use XMPP?

Google Talk
Facebook Chat
Android Intents

Internet of things
Utility companies
Gaming applications

Many, many more places which don't advertise its usage...

What is it?

Came about in an era of closed protocol chat systems:
AIM, ICQ, Yahoo! Messenger, etc

Designed to be like the web
  • Open standard
  • Federated
  • Secure
  • Scalable (messages are pushed)
  • Decentralised
  • Asynchronous
  • Community
  • Proven (14 years old)

Where XMPP wins

At its core very simple set of functionality:
IM and Presence

The 'X' is what makes XMPP such a a great system:

  • Multi-user chat [XEP-0045]
  • Publish-Subscribe [XEP-0060]
  • Jingle (P2P media sessions) [XEP-0166]

http://xmpp.org/xmpp-protocols/xmpp-extensions/ (XEP-0319)

People also build their own or overload existing standards e.g.
  • buddycloud
  • Chesspark (uses MUC as a data transport)


JID: Your unique identifier on the network


  • lloyd: Username
  • evilprofessor.co.uk: Domain
  • mozldn: Resource

A user can be logged in from multiple resources at once (phone, desktop, laptop, tablet, etc).

Each can have a priority which helps route messages to the appropriate device.

XMPP Base Messages

<message from="lloyd@evilprofessor.co.uk/moxldn"
<body>I'm giving my talk at MozLdn</body>

<presence type="dnd">
<status>Giving a talk....</status>

<iq to="lloyd@evilprofessor.co.uk" id="1">
<query xmlns="jabber:iq:roster" />

...but there's a problem

XMPP *is* real-time on the web

...but its not real-time in the web-browser (yet)

People are building new silos and solving the same problems already solved with XMPP


What's wrong with XML?

  • Many web developers exposure hasn't been great
  • Slow in the browser
  • Takes lots of code to build XML objects

The browser is all about JSON: quick, simple, fast

Web developers also want minimal APIs and fast implementation


http://xmpp.org/extensions/xep-0295.html (JOKE!)
    {"s":"<message to='alice@wonderland.lit' id='if00lu'><body>Hi you</body><body xml:lang='cy'>Prynhawn da</body><nick xmlns='http://jabber.org/protocol/nick'>Alice</nick><active xmlns='http://jabber.org/protocol/chatstates'/></message>"
  • Write better client libraries
(open source project at CISCO, strophe.js)

  • Rewrite XMPP to use JSON natively
- throwing away lots of experience/learning/standards
- which server do you pick?

  • Translate XML ↔ JSON
- Generic XML↔JSON schema?
- Choose a subset of XMPP which can be understood (stanza.io)
- Something else...


(XMPP For The Web/Win)


Started coding it up at XMPP Summit Brussels January '13

Written in nodejs

Acts as a translation layer between XMPP XML and JSON for the browser

Uses named events to reduce the amount of data the browser/web developer needs to work with

What's changed?

XMPP now becomes quick, easy, fast in the browser:

Send a message

                "to": "other@example.com",
                "message": "Hello world"

Receive a chat message

        socket.on('xmpp.chat.message', function(data) {
            console.log('Got message from ' + data.from)
            console.log('Content was: ' + data.content)
Server adds very minimal overhead


  • Login
  • Basic Presence
  • Roster
  • Chat
  • Multi-user chat (MUC XEP-0045)
  • XEP-0004 (data forms) support -- needs documenting
  • Extensible - add your own private extensions

Next steps

  • Client errors
  • Discovery (DISCO XEP-0030)
  • Rich chat messages (XEP-0071)
  • Chat status notifications (XEP-0085)
  • Implement pubsub (XEP-0060+ )
  • Add engine.io --- support older browsers too!

Try it yourself



Presents all of the incoming/outgoing messages with example payloads

Demo Client

Purely javascript
Parses the manual and hooks on to incoming messages and gives autocomplete (with example payload) for outgoing messages


Where it all goes horribly wrong!

Set my presence
Add user to my roster
Allow them to subscribe to my presence
Chat with them
Create a MUC room
Speak in the MUC


Have you heard of the 15 minute CMS?

Use XMPP-FTW to build a chat client in 15 minutes...