Más contenido relacionado La actualidad más candente (20) Similar a The Real Time Web with XMPP (20) The Real Time Web with XMPP1. The Real Time Web with XMPP
an Introduction to Strophe.js
Jack Moffitt
Collecta
28. <message
from=’juliet@book.lit/home’
to=’romeo@book.lit’
type=’chat’>
<body>
Wherefore art thou, Romeo?
</body>
</message>
29. <message
from=’juliet@book.lit/home’
to=’romeo@book.lit’
type=’chat’>
<body>
Wherefore art thou, Romeo?
</body>
</message>
30. <message
from=’juliet@book.lit/home’
to=’romeo@book.lit’
type=’chat’>
<body>
Wherefore art thou, Romeo?
</body>
</message>
31. <message
from=’juliet@book.lit/home’
to=’romeo@book.lit’
type=’chat’>
<body>
Wherefore art thou, Romeo?
</body>
</message>
32. <message
from=’juliet@book.lit/home’
to=’romeo@book.lit’
type=’chat’>
<body>
Wherefore art thou, Romeo?
</body>
</message>
35. <presence
type=‘away’>
<show>away</show>
<status>At JSConf 2009</status>
</presence>
36. <presence
type=‘away’>
<show>away</show>
<status>At JSConf 2009</status>
</presence>
37. <presence
type=‘away’>
<show>away</show>
<status>At JSConf 2009</status>
</presence>
39. <iq
to=‘book.lit’
type=’get’
id=’disco:1’>
<query xmlns=’disco#info’/>
</iq>
40. <iq
to=‘book.lit’
type=’get’
id=’disco:1’>
<query xmlns=’disco#info’/>
</iq>
41. <iq
to=‘book.lit’
type=’get’
id=’disco:1’>
<query xmlns=’disco#info’/>
</iq>
42. <iq
to=‘book.lit’
type=’get’
id=’disco:1’>
<query xmlns=’disco#info’/>
</iq>
43. <iq
to=‘book.lit’
type=’get’
id=’disco:1’>
<query xmlns=’disco#info’/>
</iq>
44. <iq
to=’romeo@book.lit/home’
from=‘book.lit’
type=’result’
id=’disco:1’>
<query xmlns=’disco#info’>
<identity category='server' type='im'
name='ejabberd'/>
<feature var='vcard-temp'/>
</query>
</iq>
45. <iq
to=’romeo@book.lit/home’
from=‘book.lit’
type=’result’
id=’disco:1’>
<query xmlns=’disco#info’>
<identity category='server' type='im'
name='ejabberd'/>
<feature var='vcard-temp'/>
</query>
</iq>
46. <iq
to=’romeo@book.lit/home’
from=‘book.lit’
type=’result’
id=’disco:1’>
<query xmlns=’disco#info’>
<identity category='server' type='im'
name='ejabberd'/>
<feature var='vcard-temp'/>
</query>
</iq>
47. <iq
to=’romeo@book.lit/home’
from=‘book.lit’
type=’result’
id=’disco:1’>
<query xmlns=’disco#info’>
<identity category='server'
type='im'
name='ejabberd'/>
<feature var='vcard-temp'/>
</query>
</iq>
73. connecting
authenticating
authentication failed
connected
disconnecting
disconnected
85. User clicks send button
$(‘#send’).click(function () {
// build message stanza
// send message
});
88. Respond to matched stanzas
function on_message(msg) {
// extract message body
// display text
return true;
}
97. var stanza = new Strophe.Builder(
“message”,
{“to”: “someone@jabber.org”,
“type”: “chat”}
);
105. new Strophe.Builder(
“message”,
{“to”: “someone@jabber.org”,
“type”: “chat”}
).c(“body”).t(“Hello, World!”);
106. new Strophe.Builder(
“message”,
{“to”: “...”, “type”: “chat”}
).c(“body”).t(“Hi”)
.up()
.c(“html”,
{“xmlns”: “.../xhtml-im”})
.c(“body”, ...)
.c(“p”).t(“Hi”)