XMPP Protocol The Extensible Messaging and Presence Protocol

Tehran User Group Hamidreza Soleimani September 01, 2014 What is it

It is It is not

- eXtensible - Binary Protocol - Messaging & Presence - General Purpose - Protocol - or Daemon

And also

- Open Protocol - Application Layer - XML Based - Asynchronous

- Long Lived Connection History

1998 Jabber Protocol Was Invented By Jeremie Miller to scratch his itch 1999 First Release of JabberD 2000 Open-Source Community and Jabber Many open-source clients were developed Its Java and Perl library were developed Details of its wire protocol was documented JabberD version 1.0 was released 2004 IETF and Jabber XMPP Protocol published [RFC 3290-1] 2005 Google and XMPP GTalk launched over XMPP 2008 Cisco and XMPP Jabber Inc. was acquired by Cisco Co. 2010 and XMPP Facebook opened up XMPP interface for its chat 2011 Modified XMPP by IETF [RFC 6120-1]

i s

p Primitives

/

m i

. XMPP

g

u l

h Client

e

t

@

u

y from=”[email protected]/pidgin” to=”tehlug.im”/>

X L

M M

L X

S

m m i

t

. a

XMPP from=”[email protected]/pidgin” a

g e

n

r u

z t l to=”[email protected]”>

a

S h

Server e

L Hello dude!

t

M

X

[ ... ]

X L

M M

L

X from=”[email protected]/pidgin”

n i

g to=”tehlug.im”

d i

p type=”unavailable”/>

/

m

i

. g

u XMPP

l

h e t Client

@

e m Usage

Whats app Instant Group Chat Gtalk VOIP Messaging Nimbuzz

Chesspark Gaming Collaboration Cisco WebEx

VM Vehicle Geo-location Archipel Tracking Management

vs. HTTP

XMPP vs. HTTP Asynchronous Synchronous Federated Unfederated Limited Purpose General Purpose

XMPP XMPP HTTP HTTP Server Server Server Server

XMPP XMPP HTTP HTTP Client Client Client Client

Transports

TCP BOSH WebSocket Transmission Control Bidirectional stream Over Long Lived Connection Protocol Synchronous HTTP Over HTTP

Open TCP Connection Open by HTTP Request Open by HTTP Request

Open XML Stream Send XML Stanza Upgrade to WebSocket )

S S S p

e

e e ) ) p

r r r e e

v v v A Preferably Negotiate TLS WebSocket Handshake

e e e ... Keep Alive ... s m m t

r r

r o o

a r r

(

( (

E E

E h h h

j j j C C

a a

a

W

Authenticate by SASL b ... Keep Alive ... b Open XML Stream b / /

/

b

b b

x x

e

e e n o o i

r r

r f f g

d d d e e d r r Exchange XML Packets , Get XML Stanza , Exchange XML Frames , i i i

T T T P F F

i i i ( ( (

g g

g t t t

a a a n n n

s

s s

e e

e e e e i i Close XML Stream i Close XML Stream l l l

) ) ) Send XML Stanza C C C

Close TCP Connection ... Keep Alive ... Close WS Connection

Jingle

Initiator XMPP Server Responder

Offer session & parameters

- Application Type: RTP / Stub / ibb - Media Codec: Speex / G.711 / H.264 - Transport Method: - Streaming: ibb / S4b - datagram: raw-UDP / ICE-UDP Accept session & parameters T C P E 2 R P I D Get/Send public IP:Port

N T N

A

P Get/Send public IP:Port A

T U 2 N T P S

Get/Send relay IP:Port S

y T Y

m A N

A Get/Send relay IP:Port R N

. L

.

N U E

A T R m

T y S Terminate session Terminate session

STUN TURN TURN STUN Server Server Server Server

XMPP Signaling Channel ICE: Interactive Communication Establishment ICE Signaling Channel STUN: Session Traversal Utilities for NAT Media Exchange Channel TURN: Traversal Using Relay around NAT Question?

Hamidreza-s..com