Regenerated docs

This commit is contained in:
JC Brand 2013-08-24 16:11:36 +02:00
parent 7e854edb48
commit c7029d8771
3 changed files with 71 additions and 82 deletions

Binary file not shown.

View File

@ -188,15 +188,17 @@ Jack Moffitt has a great `blogpost`_ about this and even provides an `example Dj
.. Note:: .. Note::
If you want to enable single session support, make sure to pass **prebind: true** If you want to enable single session support, make sure to pass **prebind: true**
when you call **converse.initialize** (see ./index.html). when you call **converse.initialize** (see ./index.html).
Additionally you need to pass in valid **jid**, **sid**, **rid** and
**bosh_service_url** values.
When you authenticate to the XMPP server on your backend, you'll receive two When you authenticate to the XMPP server on your backend, you'll receive two
tokens, RID (request ID) and SID (session ID). tokens, RID (request ID) and SID (session ID).
These tokens then need to be passed back to the javascript running in your These tokens then need to be passed back to the javascript running in your
browser, where you will need them attach to the existing session. browser, where you will need them to attach to the existing session.
You can embed the RID and SID tokens in your HTML markup or you can do an You can embed the RID and SID tokens in your HTML markup or you can do an
XMLHttpRequest call to you server and ask it to return them for you. XMLHttpRequest call to your server and ask it to return them for you.
Below is one example of how this could work. An Ajax call is made to the Below is one example of how this could work. An Ajax call is made to the
relative URL **/prebind** and it expects to receive JSON data back. relative URL **/prebind** and it expects to receive JSON data back.
@ -204,26 +206,19 @@ relative URL **/prebind** and it expects to receive JSON data back.
:: ::
$.getJSON('/prebind', function (data) { $.getJSON('/prebind', function (data) {
var connection = new Strophe.Connection(converse.bosh_service_url); converse.initialize({
connection.attach(data.jid, data.sid, data.rid, function (status) { prebind: true,
if ((status === Strophe.Status.ATTACHED) || (status === Strophe.Status.CONNECTED)) { bosh_service_url: data.bosh_service_url,
converse.onConnected(connection) jid: data.jid,
} sid: data.sid,
rid: data.rid
}); });
}
); );
**Here's what's happening:** **Here's what's happening:**
The JSON data contains the user's JID (jabber ID), RID and SID. The URL to the The JSON data contains the user's JID (jabber ID), RID, SID and the URL to the
BOSH connection manager is already set as a configuration setting on the BOSH connection manager.
*converse* object (see ./main.js), so we can reuse it from there.
A new Strophe.Connection object is instantiated and then *attach* is called with
the user's JID, the necessary tokens and a callback function.
In the callback function, you call *converse.onConnected* together with the
connection object.
Facebook integration Facebook integration
@ -471,22 +466,28 @@ If set to true, debugging output will be logged to the browser console.
fullname fullname
-------- --------
If you are using prebinding, you need to specify the fullname of the currently If you are using prebinding, can specify the fullname of the currently
logged in user. logged in user, otherwise the user's vCard will be fetched.
hide_muc_server hide_muc_server
--------------- ---------------
Default = False Default = false
Hide the ``server`` input field of the form inside the ``Room`` panel of the Hide the ``server`` input field of the form inside the ``Room`` panel of the
controlbox. Useful if you want to restrict users to a specific XMPP server of controlbox. Useful if you want to restrict users to a specific XMPP server of
your choosing. your choosing.
i18n
----
Specify the locale/language. The language must be in the ``locales`` object. Refer to
``./locale/locales.js`` to see which locales are supported.
prebind prebind
-------- --------
Default = False Default = false
Use this option when you want to attach to an existing XMPP connection that was Use this option when you want to attach to an existing XMPP connection that was
already authenticated (usually on the backend before page load). already authenticated (usually on the backend before page load).
@ -494,26 +495,19 @@ already authenticated (usually on the backend before page load).
This is useful when you don't want to render the login form on the chat control This is useful when you don't want to render the login form on the chat control
box with each page load. box with each page load.
When set to true, you'll need to make sure that the onConnected method is For prebinding to work, your backend server must authenticate for you, and
called, and passed to it a Strophe connection object. then return a JID (jabber ID), SID (session ID) and RID (Request ID).
Besides requiring the back-end to authenticate you, you'll also If you set ``prebind`` to ``true``, you have to make sure to also pass in these
have to write a Javascript snippet to attach to the set up connection:: values as ``jid``, ``sid``, ``rid``.
$.JSON({ Additionally, you have to specify ``bosh_service_url``.
'url': 'mysite.com/xmpp-authenticate',
'success': function (data) {
connection = new Strophe.Connection(bosh_service_url);
connection.attach(data.jid, data.sid, data.rid, converse.onConnected);
}
The backend must authenticate for you, and then return a SID (session ID) and
RID (Request ID), which you use when you attach to the connection.
show_controlbox_by_default show_controlbox_by_default
-------------------------- --------------------------
Default = False Default = false
The "controlbox" refers to the special chatbox containing your contacts roster, The "controlbox" refers to the special chatbox containing your contacts roster,
status widget, chatrooms and other controls. status widget, chatrooms and other controls.

View File

@ -102,18 +102,19 @@
<li><a class="reference internal" href="#debug" id="id26">debug</a></li> <li><a class="reference internal" href="#debug" id="id26">debug</a></li>
<li><a class="reference internal" href="#fullname" id="id27">fullname</a></li> <li><a class="reference internal" href="#fullname" id="id27">fullname</a></li>
<li><a class="reference internal" href="#hide-muc-server" id="id28">hide_muc_server</a></li> <li><a class="reference internal" href="#hide-muc-server" id="id28">hide_muc_server</a></li>
<li><a class="reference internal" href="#prebind" id="id29">prebind</a></li> <li><a class="reference internal" href="#i18n" id="id29">i18n</a></li>
<li><a class="reference internal" href="#show-controlbox-by-default" id="id30">show_controlbox_by_default</a></li> <li><a class="reference internal" href="#prebind" id="id30">prebind</a></li>
<li><a class="reference internal" href="#xhr-user-search" id="id31">xhr_user_search</a></li> <li><a class="reference internal" href="#show-controlbox-by-default" id="id31">show_controlbox_by_default</a></li>
<li><a class="reference internal" href="#xhr-user-search" id="id32">xhr_user_search</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#minification" id="id32">Minification</a><ul> <li><a class="reference internal" href="#minification" id="id33">Minification</a><ul>
<li><a class="reference internal" href="#minifying-javascript-and-css" id="id33">Minifying Javascript and CSS</a></li> <li><a class="reference internal" href="#minifying-javascript-and-css" id="id34">Minifying Javascript and CSS</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#translations" id="id34">Translations</a></li> <li><a class="reference internal" href="#translations" id="id35">Translations</a></li>
</ul> </ul>
</div> </div>
<div class="section" id="quickstart-to-get-a-demo-up-and-running"> <div class="section" id="quickstart-to-get-a-demo-up-and-running">
@ -244,34 +245,31 @@ but this will require custom code on your server.</p>
<div class="admonition note"> <div class="admonition note">
<p class="first admonition-title">Note</p> <p class="first admonition-title">Note</p>
<p class="last">If you want to enable single session support, make sure to pass <strong>prebind: true</strong> <p class="last">If you want to enable single session support, make sure to pass <strong>prebind: true</strong>
when you call <strong>converse.initialize</strong> (see ./index.html).</p> when you call <strong>converse.initialize</strong> (see ./index.html).
Additionally you need to pass in valid <strong>jid</strong>, <strong>sid</strong>, <strong>rid</strong> and
<strong>bosh_service_url</strong> values.</p>
</div> </div>
<p>When you authenticate to the XMPP server on your backend, you&#8217;ll receive two <p>When you authenticate to the XMPP server on your backend, you&#8217;ll receive two
tokens, RID (request ID) and SID (session ID).</p> tokens, RID (request ID) and SID (session ID).</p>
<p>These tokens then need to be passed back to the javascript running in your <p>These tokens then need to be passed back to the javascript running in your
browser, where you will need them attach to the existing session.</p> browser, where you will need them to attach to the existing session.</p>
<p>You can embed the RID and SID tokens in your HTML markup or you can do an <p>You can embed the RID and SID tokens in your HTML markup or you can do an
XMLHttpRequest call to you server and ask it to return them for you.</p> XMLHttpRequest call to your server and ask it to return them for you.</p>
<p>Below is one example of how this could work. An Ajax call is made to the <p>Below is one example of how this could work. An Ajax call is made to the
relative URL <strong>/prebind</strong> and it expects to receive JSON data back.</p> relative URL <strong>/prebind</strong> and it expects to receive JSON data back.</p>
<div class="highlight-python"><pre>$.getJSON('/prebind', function (data) { <div class="highlight-python"><pre>$.getJSON('/prebind', function (data) {
var connection = new Strophe.Connection(converse.bosh_service_url); converse.initialize({
connection.attach(data.jid, data.sid, data.rid, function (status) { prebind: true,
if ((status === Strophe.Status.ATTACHED) || (status === Strophe.Status.CONNECTED)) { bosh_service_url: data.bosh_service_url,
converse.onConnected(connection) jid: data.jid,
} sid: data.sid,
rid: data.rid
}); });
}
);</pre> );</pre>
</div> </div>
<p><strong>Here&#8217;s what&#8217;s happening:</strong></p> <p><strong>Here&#8217;s what&#8217;s happening:</strong></p>
<p>The JSON data contains the user&#8217;s JID (jabber ID), RID and SID. The URL to the <p>The JSON data contains the user&#8217;s JID (jabber ID), RID, SID and the URL to the
BOSH connection manager is already set as a configuration setting on the BOSH connection manager.</p>
<em>converse</em> object (see ./main.js), so we can reuse it from there.</p>
<p>A new Strophe.Connection object is instantiated and then <em>attach</em> is called with
the user&#8217;s JID, the necessary tokens and a callback function.</p>
<p>In the callback function, you call <em>converse.onConnected</em> together with the
connection object.</p>
</div> </div>
</div> </div>
<div class="section" id="facebook-integration"> <div class="section" id="facebook-integration">
@ -450,40 +448,37 @@ a middle man between HTTP and XMPP.</p>
</div> </div>
<div class="section" id="fullname"> <div class="section" id="fullname">
<h3><a class="toc-backref" href="#id27">fullname</a><a class="headerlink" href="#fullname" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#id27">fullname</a><a class="headerlink" href="#fullname" title="Permalink to this headline"></a></h3>
<p>If you are using prebinding, you need to specify the fullname of the currently <p>If you are using prebinding, can specify the fullname of the currently
logged in user.</p> logged in user, otherwise the user&#8217;s vCard will be fetched.</p>
</div> </div>
<div class="section" id="hide-muc-server"> <div class="section" id="hide-muc-server">
<h3><a class="toc-backref" href="#id28">hide_muc_server</a><a class="headerlink" href="#hide-muc-server" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#id28">hide_muc_server</a><a class="headerlink" href="#hide-muc-server" title="Permalink to this headline"></a></h3>
<p>Default = False</p> <p>Default = false</p>
<p>Hide the <tt class="docutils literal"><span class="pre">server</span></tt> input field of the form inside the <tt class="docutils literal"><span class="pre">Room</span></tt> panel of the <p>Hide the <tt class="docutils literal"><span class="pre">server</span></tt> input field of the form inside the <tt class="docutils literal"><span class="pre">Room</span></tt> panel of the
controlbox. Useful if you want to restrict users to a specific XMPP server of controlbox. Useful if you want to restrict users to a specific XMPP server of
your choosing.</p> your choosing.</p>
</div> </div>
<div class="section" id="i18n">
<h3><a class="toc-backref" href="#id29">i18n</a><a class="headerlink" href="#i18n" title="Permalink to this headline"></a></h3>
<p>Specify the locale/language. The language must be in the <tt class="docutils literal"><span class="pre">locales</span></tt> object. Refer to
<tt class="docutils literal"><span class="pre">./locale/locales.js</span></tt> to see which locales are supported.</p>
</div>
<div class="section" id="prebind"> <div class="section" id="prebind">
<h3><a class="toc-backref" href="#id29">prebind</a><a class="headerlink" href="#prebind" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#id30">prebind</a><a class="headerlink" href="#prebind" title="Permalink to this headline"></a></h3>
<p>Default = False</p> <p>Default = false</p>
<p>Use this option when you want to attach to an existing XMPP connection that was <p>Use this option when you want to attach to an existing XMPP connection that was
already authenticated (usually on the backend before page load).</p> already authenticated (usually on the backend before page load).</p>
<p>This is useful when you don&#8217;t want to render the login form on the chat control <p>This is useful when you don&#8217;t want to render the login form on the chat control
box with each page load.</p> box with each page load.</p>
<p>When set to true, you&#8217;ll need to make sure that the onConnected method is <p>For prebinding to work, your backend server must authenticate for you, and
called, and passed to it a Strophe connection object.</p> then return a JID (jabber ID), SID (session ID) and RID (Request ID).</p>
<p>Besides requiring the back-end to authenticate you, you&#8217;ll also <p>If you set <tt class="docutils literal"><span class="pre">prebind</span></tt> to <tt class="docutils literal"><span class="pre">true</span></tt>, you have to make sure to also pass in these
have to write a Javascript snippet to attach to the set up connection:</p> values as <tt class="docutils literal"><span class="pre">jid</span></tt>, <tt class="docutils literal"><span class="pre">sid</span></tt>, <tt class="docutils literal"><span class="pre">rid</span></tt>.</p>
<div class="highlight-python"><pre>$.JSON({ <p>Additionally, you have to specify <tt class="docutils literal"><span class="pre">bosh_service_url</span></tt>.</p>
'url': 'mysite.com/xmpp-authenticate',
'success': function (data) {
connection = new Strophe.Connection(bosh_service_url);
connection.attach(data.jid, data.sid, data.rid, converse.onConnected);
}</pre>
</div>
<p>The backend must authenticate for you, and then return a SID (session ID) and
RID (Request ID), which you use when you attach to the connection.</p>
</div> </div>
<div class="section" id="show-controlbox-by-default"> <div class="section" id="show-controlbox-by-default">
<h3><a class="toc-backref" href="#id30">show_controlbox_by_default</a><a class="headerlink" href="#show-controlbox-by-default" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#id31">show_controlbox_by_default</a><a class="headerlink" href="#show-controlbox-by-default" title="Permalink to this headline"></a></h3>
<p>Default = False</p> <p>Default = false</p>
<p>The &#8220;controlbox&#8221; refers to the special chatbox containing your contacts roster, <p>The &#8220;controlbox&#8221; refers to the special chatbox containing your contacts roster,
status widget, chatrooms and other controls.</p> status widget, chatrooms and other controls.</p>
<p>By default this box is hidden and can be toggled by clicking on any element in <p>By default this box is hidden and can be toggled by clicking on any element in
@ -492,7 +487,7 @@ the page with class <em>toggle-online-users</em>.</p>
page load.</p> page load.</p>
</div> </div>
<div class="section" id="xhr-user-search"> <div class="section" id="xhr-user-search">
<h3><a class="toc-backref" href="#id31">xhr_user_search</a><a class="headerlink" href="#xhr-user-search" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#id32">xhr_user_search</a><a class="headerlink" href="#xhr-user-search" title="Permalink to this headline"></a></h3>
<p>Default = False</p> <p>Default = False</p>
<p>There are two ways to add users.</p> <p>There are two ways to add users.</p>
<ul class="simple"> <ul class="simple">
@ -505,9 +500,9 @@ be used.</p>
</div> </div>
</div> </div>
<div class="section" id="minification"> <div class="section" id="minification">
<h1><a class="toc-backref" href="#id32">Minification</a><a class="headerlink" href="#minification" title="Permalink to this headline"></a></h1> <h1><a class="toc-backref" href="#id33">Minification</a><a class="headerlink" href="#minification" title="Permalink to this headline"></a></h1>
<div class="section" id="minifying-javascript-and-css"> <div class="section" id="minifying-javascript-and-css">
<h2><a class="toc-backref" href="#id33">Minifying Javascript and CSS</a><a class="headerlink" href="#minifying-javascript-and-css" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#id34">Minifying Javascript and CSS</a><a class="headerlink" href="#minifying-javascript-and-css" title="Permalink to this headline"></a></h2>
<p>Please make sure to read the section <a class="reference internal" href="#development">Development</a> and that you have installed <p>Please make sure to read the section <a class="reference internal" href="#development">Development</a> and that you have installed
all development dependencies (long story short, you can run <tt class="docutils literal"><span class="pre">npm</span> <span class="pre">install</span></tt> all development dependencies (long story short, you can run <tt class="docutils literal"><span class="pre">npm</span> <span class="pre">install</span></tt>
and then <tt class="docutils literal"><span class="pre">grunt</span> <span class="pre">fetch</span></tt>).</p> and then <tt class="docutils literal"><span class="pre">grunt</span> <span class="pre">fetch</span></tt>).</p>
@ -523,7 +518,7 @@ You can <a class="reference external" href="http://requirejs.org/docs/optimizati
</div> </div>
</div> </div>
<div class="section" id="translations"> <div class="section" id="translations">
<h1><a class="toc-backref" href="#id34">Translations</a><a class="headerlink" href="#translations" title="Permalink to this headline"></a></h1> <h1><a class="toc-backref" href="#id35">Translations</a><a class="headerlink" href="#translations" title="Permalink to this headline"></a></h1>
<div class="admonition note"> <div class="admonition note">
<p class="first admonition-title">Note</p> <p class="first admonition-title">Note</p>
<p class="last">Translations take up a lot of space and will bloat your minified file. <p class="last">Translations take up a lot of space and will bloat your minified file.