@@ -172,6 +173,32 @@ website. This will remove the need for any cross-domain XHR support.</p>
authenticated in your website will also automatically be logged in on the chat server,
but this will require custom code on your server.</p>
<p>Jack Moffitt has a great <aclass="reference external"href="http://metajack.im/2008/10/03/getting-attached-to-strophe">blogpost</a> about this and even provides an <aclass="reference external"href="https://github.com/metajack/strophejs/tree/master/examples/attach">example Django application</a> to demonstrate it.</p>
<p>When you authenticate to the XMPP server on your backend, you’ll receive two
tokens, RID (request ID) and SID (session ID).</p>
<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>
<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>
<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>
<divclass="highlight-python"><pre>$.getJSON('/prebind', function (data) {
var connection = new Strophe.Connection(converse.bosh_service_url);
connection.attach(data.jid, data.sid, data.rid, function (status) {
if ((status === Strophe.Status.ATTACHED) || (status === Strophe.Status.CONNECTED)) {
<h3><aclass="toc-backref"href="#id18">show_controlbox_by_default</a><aclass="headerlink"href="#show-controlbox-by-default"title="Permalink to this headline">¶</a></h3>
<p>Default = False</p>
<p>The “controlbox” refers to the special chatbox containing your contacts roster,
status widget, chatrooms and other controls.</p>
<p>By default this box is hidden and can be toggled by clicking on any element in
the page with class <em>toggle-online-users</em>.</p>
<p>If this options is set to true, the controlbox will by default be shown upon
page load.</p>
</div>
<divclass="section"id="xhr-user-search">
<h3><aclass="toc-backref"href="#id18">xhr_user_search</a><aclass="headerlink"href="#xhr-user-search"title="Permalink to this headline">¶</a></h3>
<h3><aclass="toc-backref"href="#id19">xhr_user_search</a><aclass="headerlink"href="#xhr-user-search"title="Permalink to this headline">¶</a></h3>
<p>Default = False</p>
<p>There are two ways to add users.</p>
<ulclass="simple">
...
...
@@ -289,9 +326,9 @@ be used.</p>
</div>
</div>
<divclass="section"id="minification">
<h1><aclass="toc-backref"href="#id19">Minification</a><aclass="headerlink"href="#minification"title="Permalink to this headline">¶</a></h1>
<h1><aclass="toc-backref"href="#id20">Minification</a><aclass="headerlink"href="#minification"title="Permalink to this headline">¶</a></h1>
<divclass="section"id="minifying-javascript">
<h2><aclass="toc-backref"href="#id20">Minifying Javascript</a><aclass="headerlink"href="#minifying-javascript"title="Permalink to this headline">¶</a></h2>
<h2><aclass="toc-backref"href="#id21">Minifying Javascript</a><aclass="headerlink"href="#minifying-javascript"title="Permalink to this headline">¶</a></h2>
<p>We use <aclass="reference external"href="http://requirejs.org">require.js</a> to keep track of <em>Converse.js</em> and its dependencies and to
to bundle them together in a single minified file fit for deployment to a
production site.</p>
...
...
@@ -307,14 +344,14 @@ manager, NPM.</p>
<p>You can <aclass="reference external"href="http://requirejs.org/docs/optimization.html">read more about require.js’s optimizer here</a>.</p>
</div>
<divclass="section"id="minifying-css">
<h2><aclass="toc-backref"href="#id21">Minifying CSS</a><aclass="headerlink"href="#minifying-css"title="Permalink to this headline">¶</a></h2>
<h2><aclass="toc-backref"href="#id22">Minifying CSS</a><aclass="headerlink"href="#minifying-css"title="Permalink to this headline">¶</a></h2>
<p>CSS can be minimized with Yahoo’s yuicompressor tool:</p>