WTF is XMPP?

melopt 4,126 views 38 slides Sep 16, 2008
Slide 1
Slide 1 of 38
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38

About This Presentation

An small introduction to XMPP focusing on non-instant messaging uses


Slide Content

WTF is XMPP
Pedro Melo <{xmpp,mailto}:[email protected]>

XMPP
•Almost 10 years old
•IETF standard (RFC 3920 & RFC 3921)
•More than 100 extensions
•Started as Jabber: XMPP is the protocol
powering Jabber Instant Messaging
Network

Who uses it?
•SAPO
•GTalk
•Jabber.TLD
•Yahoo! (the Video conference site)
•AIM (private interconnects)
•US DoD (big BIG users), UK Armed Forces

So really, WTF is
XMPP?
•XML Streams: send small XML stanzas
•Simple building blocks
•Extensible: add your stuff, no need to ask
permission
•Secure (TLS security is mandatory, CA
available with free certificates)
•Federated

Building Blocks
•<presence>, <message>, <iq>
•update your own state on the network
•chat, notify others
•query/response interface - almost REST
•More advanced: capability discovery,
publish/subscribe, negotiate out-of-band
channels (VoIP, E2E encryption)

Extensible
•Any building block can be extended
•Just add a new child XML element with
your own XML namespace
•No need to ask anyone
•But be polite and only send them to people
who will understand it

Federated
•Each user has unique JID (Jabber ID)
•local_name@domain
•Each active connection gets a resource
•local_name@domain/resource
•Domains find to each other using DNS SRV
records, connect using secure TLS

A XMPP Network
Zee Big Picture

But this is IM...

XMPP = IM . C
2

XMPP = IM . C
2
Because bots talks at light-speed :)

Bots
•Bots are the initial first step to build a
XMPP presence
•Notifications
•Include Atom alternative payload
•Interaction with a service
•Text-based command line-style

So how do I start?

First, pick a Server
•Install your own server
•Allows you to use your own domain/brand
•Two choices:
•ejabberd
•OpenFire
•Personally I use ejabberd and djabberd

Second, pick a library
•Do not try to build one yourself :)
•Python: use Twisted XMPP (Worlds)
•Perl: Net::XMPP2 (soon AnyEvent::XMPP)
•Ruby: I don’t like any of them :)

Third, start coding

But how do I connect
to the XMPP network?
We got some great opportunities for you today

C2S vs Components
•C2S bots are simple to start and play
•Components are the only way to fly long
term
•Zero protocol limitations if you use a
Component
•With ejabberd you have component load-
balancing built-in (plus clustering bonus)

That’s it

But lets talk about the
Myths

Myth 1: XMPP is
complex
•XMPP is Async, and you have to think Async
to keep your sanity
•Frameworks that hide the Async nature of
XMPP are doing more harm than good
•XMPP has lots of specs but they are very
well written (thx to our personal Saint)
•The basics are really pretty simple

Myth 2: XML is too
verbose
•Yes it is. So what?
•Compression helps a lot
•But you don’t have to use XML
•Really!

XMPP without XML?
(the speaker is on drugs...)

Can we build it?
•The protocol for C2S components is not
standard
•Each server implements his own (OpenFire
has the best specs, DJabberd is hackable,
Jabberd2 and ejabberd have the possibility)
•Mobile clients are taking this route

Myth 3: XMPP is
replacing the Web

Myth 3: XMPP is
replacing the Web
Who ever tells you this, has a better dealer than mine...

Myth 3: XMPP is
replacing the Web
•No, its not
•XMPP is a nice complement to your web
applications
•Gives you a real-time feedback channel
•something happened to your data
•something happened to your friends data

Enough myths, onto
Ideas

Enhance your bots
•With C2S, you have one <presence> to
rule them all (*)
•With components you can have a
<presence> per buddy
•adjust the bot status to something
meaningful
•change the Avatar image
•Accept/initiate file transfers

Add PubSub nodes
•You can have all the user events available
on the XMPP network using PubSub
•Payload is a classical Atom item
•OAuth-based access has working draft
•This is actually an economic/political
problem, not technical

Add AdHoc commands
•Discoverable actions you can perform on a
JID
•You GET a form, and then SET the data
•Also available standard search protocol
•Support is still immature on clients

Use virtual chat-rooms
•Chat-rooms provide many-to-many chat
•Each HTTP resource can have a associated
chat-room
•Click to chat just join people looking at the
same page into the same chat-room
•You can even do it in the page
(Sameplace.cc)

Negative Priority
•Here be dragons...
•If IM is the known planets, negative priority
is all the space in between
•Personal agents: connect with your own
personal JID, and perform/accept actions on
your behalf

Negative Priority
•Calendar: XMPP bot built-in: negotiate/
accept/reject meeting requests
•File Server: runs on each PC you own, and
allow you to browse, fetch, upload files
•Browser: share tabs between two running
instances - synchronized browsing

Usual suspects
•Control a cluster: Vertebra
•Monitor stuff: embed a bot on all your
scripts/long-running processes
•Your own personal secretary: remind me to
pick up the kids

Think of a Real-Time
feedback channel in
your own app...

... one that knows when
the users are online

That’s all, folks!