Colliding Worlds: Using Jabber to make awesome web sites - Blain Cook

52

Transcript of Colliding Worlds: Using Jabber to make awesome web sites - Blain Cook

— 2000.

client——— changes?——— changes?——— changes?——— changes?—————————————————————————————————————————————————————————————— changes?——— changes?——— changes?

servercomputer says nocomputer says nocomputer says nocomputer says no

computer says yes! computer says nocomputer says nocomputer says nocomputer says nocomputer says nocomputer says nocomputer says no

computer says yes!computer says nocomputer says no computer says no

wasted effort}

• Persistent

• Lightweight

• Bi-Directional

• Asynchronous

• Guaranteed Server Identity

Connection Properties

Protocol

<message from='[email protected]' to='[email protected]'> <body> I'm a Maverick, doncha know? </body></message>

— 2003.

<iq type='set' from='[email protected]' to='bearhunter.com' id='pub1'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <subscribe node='/bears/activity' jid='[email protected]'> </pubsub> </iq>

SUBSCRIBE /bears/activity HTTP/1.1Host: bearhunter.comContent-type: application/x-www-form-url-encodedContent-length: 24

[email protected]

<iq type='set' from='[email protected]' to='reality.com' id='pub1'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <unsubscribe node='/common_sense' jid='[email protected]'> </pubsub> </iq>

UNSUBSCRIBE /common_sense HTTP/1.1Host: reality.comContent-type: application/x-www-form-url-encodedContent-length: 24

[email protected]

<message to='[email protected]' from='bearhunter.com' id='omgbears55'> <pubsub> <items node='/bears/activity'> <item id="1853"> Bear sighted! Get your guns!</item> </items> </pubsub> </iq>

NOTIFY /people/gov.palin HTTP/1.1Host: yahoo.comContent-type: application/x-www-form-url-encodedContent-length: 22

message=Bear sighted! Get your guns!message_id=1853&node=/bears/activity&from=bearhunter.com&[email protected]

while (true) { $event = get_next_event() @matching_nodes = event.nodes()

@subscribers = "SELECT * FROM subscriptions WHERE node IN (@matching_nodes)"

foreach $subscriber in (@subscribers) { deliver_xmpp_notification($event, $subscriber) }}

<iq type='set' from='[email protected]' to='[email protected]' id='pub1'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <subscribe node='/photos' jid='[email protected]'> </pubsub> </iq>

<iq type='set' from='[email protected]' to='[email protected]' id='pub1'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <subscribe node='/photos' jid='[email protected]'> </pubsub> </iq>

<message to='[email protected]' from='[email protected]' id='243fa8'> <pubsub> <items node='/photos.atom'> <item id="tag:flickr.com,2005:/photo/1839786542"> <entry> <title>Pienso En Ti</title> <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/lattice/1839786542/"/> <id>tag:flickr.com,2005:/photo/1839786542</id> <published>2007-11-03T09:03:47Z</published> <updated>2007-11-03T09:03:47Z</updated> <author> <name>blaine</name> <uri>http://www.flickr.com/people/lattice/</uri> </author> <link rel="enclosure" type="image/jpeg" href="..." /> </entry> </item> </items> </pubsub> </iq>

<message to='[email protected]' from='[email protected]' id='243fa8'> <pubsub> <items node='/photos.atom'> <item id="tag:flickr.com,2005:/photo/1839786542"> <entry> <title>Pienso En Ti</title> <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/lattice/1839786542/"/> <id>tag:flickr.com,2005:/photo/1839786542</id> <published>2007-11-03T09:03:47Z</published> <updated>2007-11-03T09:03:47Z</updated> <author> <name>blaine</name> <uri>http://www.flickr.com/people/lattice/</uri> </author> <link rel="enclosure" type="image/jpeg" href="..." /> </entry> </item> </items> </pubsub> </iq>