source: sandbox/jabberit_messenger/trophy_expresso/strophejs/examples/attach/README @ 2397

Revision 2397, 1.2 KB checked in by alexandrecorreia, 14 years ago (diff)

Ticket #986 - Importacao do modulo trophy integrado ao expresso.

  • Property svn:executable set to *
Line 
1This is an example of Strophe attaching to a pre-existing BOSH session
2that is created externally.  This example requires a bit more than
3HTML and JavaScript.  Specifically it contains a very simple Web
4application written in Django which creates a BOSH session before
5rendering the page.
6
7Requirements:
8
9* Django 1.0 (http://www.djangoproject.com)
10* Twisted 8.1.x (http://twistedmatrix.com)
11* Punjab 0.3 (http://code.stanziq.com/punjab)
12
13Note that Twisted and Punjab are only used for small functions related
14to JID and BOSH parsing.
15
16How It Works:
17
18The Django app contains one view which is tied to the root URL.  This
19view uses the BOSHClient class to start a BOSH session using the
20settings from settings.py.
21
22Once the connection is established, Django passes the JID, SID, and
23RID for the BOSH session into the template engine and renders the
24page.
25
26The template assigns the JID, SID, and RID to global vars like so:
27
28    var BOSH_JID = {{ jid }};
29    var BOSH_SID = {{ sid }};
30    var BOSH_RID = {{ rid }};
31
32The connection is attached to Strophe by calling
33Strophe.Connection.attach() with this data and a connection callback
34handler.
35
36To show that the session is attached and works, a disco info ping is
37done to jabber.org.
Note: See TracBrowser for help on using the repository browser.