153
<exploring:xmpp/> Jack Moffitt

Exploring XMPP

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Exploring XMPP

<exploring:xmpp/>Jack Moffitt

Page 2: Exploring XMPP

Why XMPP?

Page 3: Exploring XMPP

HTTP APIs are great

Page 4: Exploring XMPP

HTTP polling sucks

Page 5: Exploring XMPP

Real time is different

Page 6: Exploring XMPP

XMPP is real time

Page 7: Exploring XMPP

XMPP basics

Page 8: Exploring XMPP

XMPP network

Page 9: Exploring XMPP
Page 10: Exploring XMPP
Page 11: Exploring XMPP
Page 12: Exploring XMPP
Page 13: Exploring XMPP

XMPP addressing

Page 14: Exploring XMPP

example.com

Page 19: Exploring XMPP

XMPP protocol

Page 20: Exploring XMPP

XML

Page 21: Exploring XMPP

XML streams

Page 22: Exploring XMPP

XML stanzas

Page 23: Exploring XMPP

<message/>

Page 24: Exploring XMPP

<presence/>

Page 25: Exploring XMPP

<iq/>

Page 26: Exploring XMPP

<message/>

Page 27: Exploring XMPP

<messagefrom=’[email protected]/home’to=’[email protected]’type=’chat’>

<body>Wherefore art thou, Romeo?

</body></message>

Page 28: Exploring XMPP

<messagefrom=’[email protected]/home’to=’[email protected]’type=’chat’>

<body>Wherefore art thou, Romeo?

</body></message>

Page 29: Exploring XMPP

<messagefrom=’[email protected]/home’to=’[email protected]’type=’chat’>

<body>Wherefore art thou, Romeo?

</body></message>

Page 30: Exploring XMPP

<messagefrom=’[email protected]/home’to=’[email protected]’type=’chat’>

<body>Wherefore art thou, Romeo?

</body></message>

Page 31: Exploring XMPP

<messagefrom=’[email protected]/home’to=’[email protected]’type=’chat’>

<body>Wherefore art thou, Romeo?

</body></message>

Page 32: Exploring XMPP

<presence/>

Page 33: Exploring XMPP

<presence><show>away</show><status>At Codebits</status>

</presence>

Page 34: Exploring XMPP

<presencetype=’available’>

<show>away</show><status>At Codebits</status>

</presence>

Page 35: Exploring XMPP

<presencetype=’available’>

<show>away</show><status>At Codebits</status>

</presence>

Page 36: Exploring XMPP

<presencetype=’available’>

<show>away</show><status>At Codebits</status>

</presence>

Page 37: Exploring XMPP

<iq/>

Page 38: Exploring XMPP

<iqto=’sapo.pt’type=’get’id=’disco:1’>

<query xmlns=’disco#info’/></iq>

Page 39: Exploring XMPP

<iqto=’sapo.pt’type=’get’id=’disco:1’>

<query xmlns=’disco#info’/></iq>

Page 40: Exploring XMPP

<iqto=’sapo.pt’type=’get’id=’disco:1’>

<query xmlns=’disco#info’/></iq>

Page 41: Exploring XMPP

<iqto=’sapo.pt’type=’get’id=’disco:1’>

<query xmlns=’disco#info’/></iq>

Page 42: Exploring XMPP

<iqto=’sapo.pt’type=’get’id=’disco:1’>

<query xmlns=’disco#info’/></iq>

Page 43: Exploring XMPP

<iqto=’[email protected]/home’from=’sapo.pt’type=’result’id=’disco:1’>

<query xmlns=’disco#info’><identity category='server' type='im'

name='ejabberd'/><feature var='vcard-temp'/>

</query></iq>

Page 44: Exploring XMPP

<iqto=’[email protected]/home’from=’sapo.pt’type=’result’id=’disco:1’>

<query xmlns=’disco#info’><identity category='server' type='im'

name='ejabberd'/><feature var='vcard-temp'/>

</query></iq>

Page 45: Exploring XMPP

<iqto=’[email protected]/home’from=’sapo.pt’type=’result’id=’disco:1’>

<query xmlns=’disco#info’><identity category='server' type='im'

name='ejabberd'/><feature var='vcard-temp'/>

</query></iq>

Page 46: Exploring XMPP

<iqto=’[email protected]/home’from=’sapo.pt’type=’result’id=’disco:1’>

<query xmlns=’disco#info’><identity category='server'type='im'name='ejabberd'/>

<feature var='vcard-temp'/></query>

</iq>

Page 47: Exploring XMPP

The application

Page 48: Exploring XMPP

example

Page 49: Exploring XMPP

contrived

Page 50: Exploring XMPP

Server monitoring

Page 51: Exploring XMPP

Goodbye SNMP

Page 52: Exploring XMPP

XMPP APIs

Page 53: Exploring XMPP

Features

Page 54: Exploring XMPP

Collection hub

Page 55: Exploring XMPP

Collectors are XMPP bots

Page 56: Exploring XMPP

Controlled via client

Page 57: Exploring XMPP

Presence

Page 58: Exploring XMPP

Discovery

Page 59: Exploring XMPP

Commands

Page 60: Exploring XMPP

Notification

Page 61: Exploring XMPP

No processing

Page 62: Exploring XMPP

Presence

Page 63: Exploring XMPP

Communicates status

Page 64: Exploring XMPP

Subscribing

Page 65: Exploring XMPP

<presence type=’subscribe’ to=’[email protected]’/>

Page 66: Exploring XMPP

<presence type=’subscribed’ from=’xmpp@mon...’ to=’client@mon...’/>

Page 67: Exploring XMPP

Rosters

Page 68: Exploring XMPP

<iq type=’get’ id=’roster1’> <query xmlns=’jabber:iq:roster’/></iq>

Page 69: Exploring XMPP

<iq type=’result’ id=’roster1’> <query xmlns=’jabber:iq:roster’> <item jid=’xmpp@mon...’ subscription=’to’/> </query></iq>

Page 70: Exploring XMPP

Initial presence

Page 71: Exploring XMPP

<presence/>

Page 72: Exploring XMPP

Starting up

Page 73: Exploring XMPP

<presence from=’xmpp@mon...’/>

Page 74: Exploring XMPP

Dead server

Page 75: Exploring XMPP

<presence type=’unavailable’ from=’xmpp@mon...’/>

Page 76: Exploring XMPP

Busy server

Page 77: Exploring XMPP

<presence type=’available’> <show>away</show> <status> Overloaded. Can’t take more jobs. </status></presence>

Page 78: Exploring XMPP

Discovery

Page 79: Exploring XMPP

Meta information

Page 80: Exploring XMPP

Disco info

Page 81: Exploring XMPP

<iq id=’disco1’ type=’get’ to=’xmpp@mon...’> <query xmlns=’.../disco#info’/></iq>

Page 82: Exploring XMPP

<iq ...> <query xmlns=’.../disco#info’> <identity name=’XMPP Monitor’ category=’monitor’ type=’server’/> </query></iq>

Page 83: Exploring XMPP

Statistics available

Page 84: Exploring XMPP

Disco items

Page 85: Exploring XMPP

<iq id=’disco2’ type=’get’ to=’xmpp@mon...’> <query xmlns=’.../disco#items’/></iq>

Page 86: Exploring XMPP

<iq ...> <query xmlns=’.../disco#items’> <item name=’CPU Load’ jid=’xmpp@mon...’ node=’cpu’/> ... </query></iq>

Page 87: Exploring XMPP

<iq ...> <query xmlns=’.../disco#items’> <item name=’CPU Load’ jid=’xmpp@mon...’ node=’cpu’/> ... </query></iq>

Page 88: Exploring XMPP

<iq ...> <query xmlns=’.../disco#items’> <item name=’CPU Load’ jid=’xmpp@mon...’ node=’cpu’/> ... </query></iq>

Page 89: Exploring XMPP

Gathering statistics

Page 90: Exploring XMPP

Disco info again

Page 91: Exploring XMPP

With a node

Page 92: Exploring XMPP

<iq id=’disco3’ type=’get’ to=’xmpp@mon...’> <query xmlns=’.../disco#info’ node=’cpu’/></iq>

Page 93: Exploring XMPP

<iq ...> <query xmlns=’.../disco#info’ node=’cpu’> <statisic xmlns=’codebits’ name=’5-min’ value=’0.4’/> </query></iq>

Page 94: Exploring XMPP

<statistic/>

Page 95: Exploring XMPP

Extended stanza

Page 96: Exploring XMPP

Create your own

Page 97: Exploring XMPP

Namespace

Page 98: Exploring XMPP

<iq ...> <query xmlns=’.../disco#info’ node=’cpu’> <statisic xmlns=’codebits’ name=’5-min’ value=’0.4’/> </query></iq>

Page 99: Exploring XMPP

Commands

Page 100: Exploring XMPP

Ad-hoc commands

Page 101: Exploring XMPP

RPC

Page 102: Exploring XMPP

Input and output

Page 103: Exploring XMPP

Data forms

Page 104: Exploring XMPP

<x xmlns='jabber:x:data' type='...'> <field type='hidden' var='FORM_TYPE'> <value>jabber:bot</value> </field> <field type='text-single' var='botname'> <value>Awesome Bot</value> </field></x>

Page 105: Exploring XMPP

<x xmlns='jabber:x:data' type='...'> <field type='hidden' var='FORM_TYPE'> <value>jabber:bot</value> </field> <field type='text-single' var='botname'> <value>Awesome Bot</value> </field></x>

Page 106: Exploring XMPP

<x xmlns='jabber:x:data' type='...'> <field type='hidden' var='FORM_TYPE'> <value>jabber:bot</value> </field> <field type='text-single' var='botname'> <value>Awesome Bot</value> </field></x>

Page 107: Exploring XMPP

<x xmlns='jabber:x:data' type='...'> <field type='hidden' var='FORM_TYPE'> <value>jabber:bot</value> </field> <field type='text-single' var='botname'> <value>Awesome Bot</value> </field></x>

Page 108: Exploring XMPP

<x xmlns='jabber:x:data' type='...'> <field type='hidden' var='FORM_TYPE'> <value>jabber:bot</value> </field> <field type='text-single' var='botname'> <value>Awesome Bot</value> </field></x>

Page 109: Exploring XMPP

Reboot command

Page 110: Exploring XMPP

<iq ...> <command xmlns=’.../commands’ node=’reboot’ action=’execute’/></iq>

Page 111: Exploring XMPP

<iq ...> <command xmlns=’.../commands’ node=’reboot’ action=’execute’/></iq>

Page 112: Exploring XMPP

<iq ...> <command xmlns=’.../commands’ node=’reboot’ action=’execute’/></iq>

Page 113: Exploring XMPP

<iq ...> <command xmlns=’.../commands’ node=’reboot’ status=’completed’/></iq>

Page 114: Exploring XMPP

Stats reset

Page 115: Exploring XMPP

Shell commands

Page 116: Exploring XMPP

Notifications

Page 117: Exploring XMPP

Important events

Page 118: Exploring XMPP

Limits exceeded

Page 119: Exploring XMPP

Publish subscribe

Page 120: Exploring XMPP

Pubsub

Page 121: Exploring XMPP

Nodes

Page 122: Exploring XMPP

Node hierarchy

Page 123: Exploring XMPP

Leaves

Page 124: Exploring XMPP

Collections

Page 125: Exploring XMPP

Bots publish

Page 126: Exploring XMPP

Client subscribes

Page 127: Exploring XMPP

PEP

Page 128: Exploring XMPP

Personal eventing protocol

Page 129: Exploring XMPP

Profile of pubsub

Page 130: Exploring XMPP

Simple

Page 131: Exploring XMPP

Presence

Page 132: Exploring XMPP

Every JID is a pubsub node

Page 133: Exploring XMPP

Subscriptions are automatic

Page 134: Exploring XMPP

Publishing

Page 135: Exploring XMPP

<iq ...> <pubsub xmlns=’.../pubsub’> <publish node=’codebits’> <item> <rebooted xmlns=’codebits’/> </item> </publish> </pubsub></iq>

Page 136: Exploring XMPP

<iq ...> <pubsub xmlns=’.../pubsub’> <publish node=’codebits’> <item> <rebooted xmlns=’codebits’/> </item> </publish> </pubsub></iq>

Page 137: Exploring XMPP

<iq ...> <pubsub xmlns=’.../pubsub’> <publish node=’codebits’> <item> <rebooted xmlns=’codebits’/> </item> </publish> </pubsub></iq>

Page 138: Exploring XMPP

<iq ...> <pubsub xmlns=’.../pubsub’> <publish node=’codebits’> <item> <rebooted xmlns=’codebits’/> </item> </publish> </pubsub></iq>

Page 139: Exploring XMPP

<iq ...> <pubsub xmlns=’.../pubsub’> <publish node=’codebits’> <item> <rebooted xmlns=’codebits’/> </item> </publish> </pubsub></iq>

Page 140: Exploring XMPP

Subscribing

Page 141: Exploring XMPP

Automatic

Page 142: Exploring XMPP

Entity capabilities

Page 143: Exploring XMPP

Caps

Page 144: Exploring XMPP

Caps extend presence

Page 145: Exploring XMPP

<presence> <c xmlns=’.../caps’ node=’codebits’ hash=’sha-1’ ver=’...hash...’/></presence>

Page 146: Exploring XMPP

<presence> <c xmlns=’.../caps’ node=’codebits’ hash=’sha-1’ ver=’...hash...’/></presence>

Page 147: Exploring XMPP

<presence> <c xmlns=’.../caps’ node=’codebits’ hash=’sha-1’ ver=’...hash...’/></presence>

Page 148: Exploring XMPP

Interpreted via disco

Page 149: Exploring XMPP

<feature var=’codebits’/><feature var=’codebits+notify’/>

Page 150: Exploring XMPP

Events

Page 151: Exploring XMPP

<message ...> <event xmlns=’.../pubsub’> <items node=’codebits’> <item> <rebooted xmlns=’codebits’/> </item> </items> </event></message>

Page 152: Exploring XMPP

Just add code

Page 153: Exploring XMPP

http://www.xmpp.org

http://metajack.im

[email protected]