|
@@ -7,7 +7,7 @@
|
|
|
<head>
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
|
|
- <title>Quickstart (to get a demo up and running) — Converse.js 0.5.1 documentation</title>
|
|
|
+ <title>Quickstart (to get a demo up and running) — Converse.js 0.5.3 documentation</title>
|
|
|
|
|
|
<link rel="stylesheet" href="_static/stylesheet.css" type="text/css" />
|
|
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
|
@@ -15,7 +15,7 @@
|
|
|
<script type="text/javascript">
|
|
|
var DOCUMENTATION_OPTIONS = {
|
|
|
URL_ROOT: '',
|
|
|
- VERSION: '0.5.1',
|
|
|
+ VERSION: '0.5.3',
|
|
|
COLLAPSE_INDEX: false,
|
|
|
FILE_SUFFIX: '.html',
|
|
|
HAS_SOURCE: true
|
|
@@ -24,7 +24,7 @@
|
|
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
|
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
|
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
|
|
- <link rel="top" title="Converse.js 0.5.1 documentation" href="#" />
|
|
|
+ <link rel="top" title="Converse.js 0.5.3 documentation" href="#" />
|
|
|
</head>
|
|
|
<body>
|
|
|
<div id="header_wrap" class="outer">
|
|
@@ -49,7 +49,7 @@
|
|
|
<li class="right" style="margin-right: 10px">
|
|
|
<a href="genindex.html" title="General Index"
|
|
|
accesskey="I">index</a></li>
|
|
|
- <li><a href="#">Converse.js 0.5.1 documentation</a> »</li>
|
|
|
+ <li><a href="#">Converse.js 0.5.3 documentation</a> »</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<section id="main_content" class="inner">
|
|
@@ -99,21 +99,22 @@
|
|
|
<li><a class="reference internal" href="#auto-list-rooms" id="id23">auto_list_rooms</a></li>
|
|
|
<li><a class="reference internal" href="#auto-subscribe" id="id24">auto_subscribe</a></li>
|
|
|
<li><a class="reference internal" href="#bosh-service-url" id="id25">bosh_service_url</a></li>
|
|
|
-<li><a class="reference internal" href="#fullname" id="id26">fullname</a></li>
|
|
|
-<li><a class="reference internal" href="#hide-muc-server" id="id27">hide_muc_server</a></li>
|
|
|
-<li><a class="reference internal" href="#prebind" id="id28">prebind</a></li>
|
|
|
-<li><a class="reference internal" href="#show-controlbox-by-default" id="id29">show_controlbox_by_default</a></li>
|
|
|
-<li><a class="reference internal" href="#xhr-user-search" id="id30">xhr_user_search</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="#hide-muc-server" id="id28">hide_muc_server</a></li>
|
|
|
+<li><a class="reference internal" href="#i18n" id="id29">i18n</a></li>
|
|
|
+<li><a class="reference internal" href="#prebind" id="id30">prebind</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>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</li>
|
|
|
-<li><a class="reference internal" href="#minification" id="id31">Minification</a><ul>
|
|
|
-<li><a class="reference internal" href="#minifying-javascript" id="id32">Minifying Javascript</a></li>
|
|
|
-<li><a class="reference internal" href="#minifying-css" id="id33">Minifying CSS</a></li>
|
|
|
+<li><a class="reference internal" href="#minification" id="id33">Minification</a><ul>
|
|
|
+<li><a class="reference internal" href="#minifying-javascript-and-css" id="id34">Minifying Javascript and CSS</a></li>
|
|
|
</ul>
|
|
|
</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>
|
|
|
</div>
|
|
|
<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">
|
|
|
<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>
|
|
|
-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>
|
|
|
<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>
|
|
|
+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
|
|
|
-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
|
|
|
relative URL <strong>/prebind</strong> and it expects to receive JSON data back.</p>
|
|
|
<div class="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)) {
|
|
|
- converse.onConnected(connection)
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ converse.initialize({
|
|
|
+ prebind: true,
|
|
|
+ bosh_service_url: data.bosh_service_url,
|
|
|
+ jid: data.jid,
|
|
|
+ sid: data.sid,
|
|
|
+ rid: data.rid
|
|
|
+ });
|
|
|
);</pre>
|
|
|
</div>
|
|
|
<p><strong>Here’s what’s happening:</strong></p>
|
|
|
-<p>The JSON data contains the user’s JID (jabber ID), RID and SID. The URL to the
|
|
|
-BOSH connection manager is already set as a configuration setting on the
|
|
|
-<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’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>
|
|
|
+<p>The JSON data contains the user’s JID (jabber ID), RID, SID and the URL to the
|
|
|
+BOSH connection manager.</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="section" id="facebook-integration">
|
|
@@ -444,42 +442,43 @@ option will create lots of extra connection traffic.</p>
|
|
|
a middle man between HTTP and XMPP.</p>
|
|
|
<p>See <a class="reference external" href="http://metajack.im/2008/09/08/which-bosh-server-do-you-need">here</a> for more information.</p>
|
|
|
</div>
|
|
|
+<div class="section" id="debug">
|
|
|
+<h3><a class="toc-backref" href="#id26">debug</a><a class="headerlink" href="#debug" title="Permalink to this headline">¶</a></h3>
|
|
|
+<p>If set to true, debugging output will be logged to the browser console.</p>
|
|
|
+</div>
|
|
|
<div class="section" id="fullname">
|
|
|
-<h3><a class="toc-backref" href="#id26">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
|
|
|
-logged in user.</p>
|
|
|
+<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, can specify the fullname of the currently
|
|
|
+logged in user, otherwise the user’s vCard will be fetched.</p>
|
|
|
</div>
|
|
|
<div class="section" id="hide-muc-server">
|
|
|
-<h3><a class="toc-backref" href="#id27">hide_muc_server</a><a class="headerlink" href="#hide-muc-server" title="Permalink to this headline">¶</a></h3>
|
|
|
-<p>Default = False</p>
|
|
|
+<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>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
|
|
|
your choosing.</p>
|
|
|
</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">
|
|
|
-<h3><a class="toc-backref" href="#id28">prebind</a><a class="headerlink" href="#prebind" title="Permalink to this headline">¶</a></h3>
|
|
|
-<p>Default = False</p>
|
|
|
+<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>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>
|
|
|
<p>This is useful when you don’t want to render the login form on the chat control
|
|
|
box with each page load.</p>
|
|
|
-<p>When set to true, you’ll need to make sure that the onConnected method is
|
|
|
-called, and passed to it a Strophe connection object.</p>
|
|
|
-<p>Besides requiring the back-end to authenticate you, you’ll also
|
|
|
-have to write a Javascript snippet to attach to the set up connection:</p>
|
|
|
-<div class="highlight-python"><pre>$.JSON({
|
|
|
- '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>
|
|
|
+<p>For prebinding to work, your backend server must authenticate for you, and
|
|
|
+then return a JID (jabber ID), SID (session ID) and RID (Request ID).</p>
|
|
|
+<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
|
|
|
+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>
|
|
|
+<p>Additionally, you have to specify <tt class="docutils literal"><span class="pre">bosh_service_url</span></tt>.</p>
|
|
|
</div>
|
|
|
<div class="section" id="show-controlbox-by-default">
|
|
|
-<h3><a class="toc-backref" href="#id29">show_controlbox_by_default</a><a class="headerlink" href="#show-controlbox-by-default" title="Permalink to this headline">¶</a></h3>
|
|
|
-<p>Default = False</p>
|
|
|
+<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>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
|
|
@@ -488,7 +487,7 @@ the page with class <em>toggle-online-users</em>.</p>
|
|
|
page load.</p>
|
|
|
</div>
|
|
|
<div class="section" id="xhr-user-search">
|
|
|
-<h3><a class="toc-backref" href="#id30">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>There are two ways to add users.</p>
|
|
|
<ul class="simple">
|
|
@@ -501,32 +500,25 @@ be used.</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="section" id="minification">
|
|
|
-<h1><a class="toc-backref" href="#id31">Minification</a><a class="headerlink" href="#minification" title="Permalink to this headline">¶</a></h1>
|
|
|
-<div class="section" id="minifying-javascript">
|
|
|
-<h2><a class="toc-backref" href="#id32">Minifying Javascript</a><a class="headerlink" href="#minifying-javascript" title="Permalink to this headline">¶</a></h2>
|
|
|
+<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">
|
|
|
+<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
|
|
|
+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>
|
|
|
<p>We use <a class="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>
|
|
|
-<p>To use the require.js’s optimization tool, you’ll need Node and it’s package
|
|
|
-manager, NPM.</p>
|
|
|
-<p>You can then install install require.js for Node like so:</p>
|
|
|
-<div class="highlight-python"><pre>npm install requirejs</pre>
|
|
|
-</div>
|
|
|
-<p>The minified javascript file is then created like this:</p>
|
|
|
-<div class="highlight-python"><pre>r.js -o build.js</pre>
|
|
|
-</div>
|
|
|
-<p>You should now have a new minified file (the name which is specified in build.js).</p>
|
|
|
-<p>You can <a class="reference external" href="http://requirejs.org/docs/optimization.html">read more about require.js’s optimizer here</a>.</p>
|
|
|
-</div>
|
|
|
-<div class="section" id="minifying-css">
|
|
|
-<h2><a class="toc-backref" href="#id33">Minifying CSS</a><a class="headerlink" href="#minifying-css" title="Permalink to this headline">¶</a></h2>
|
|
|
-<p>CSS can be minimized with Yahoo’s yuicompressor tool:</p>
|
|
|
-<div class="highlight-python"><pre>yui-compressor --type=css converse.css -o converse.min.css</pre>
|
|
|
+<p>To minify the Javascript and CSS, run the following command:</p>
|
|
|
+<div class="highlight-python"><pre>grunt minify</pre>
|
|
|
</div>
|
|
|
+<p>Javascript will be bundled and minified via <a class="reference external" href="http://requirejs.org">require.js</a>‘s optimization tool.
|
|
|
+You can <a class="reference external" href="http://requirejs.org/docs/optimization.html">read more about require.js’s optimizer here</a>.</p>
|
|
|
+<p>CSS is minified via <a class="reference external" href="https://github.com/gruntjs/grunt-contrib-cssmin">cssmin</a>.</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<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">
|
|
|
<p class="first admonition-title">Note</p>
|
|
|
<p class="last">Translations take up a lot of space and will bloat your minified file.
|
|
@@ -612,7 +604,7 @@ those hoops you had to jump through.</p>
|
|
|
<li class="right" style="margin-right: 10px">
|
|
|
<a href="genindex.html" title="General Index"
|
|
|
>index</a></li>
|
|
|
- <li><a href="#">Converse.js 0.5.1 documentation</a> »</li>
|
|
|
+ <li><a href="#">Converse.js 0.5.3 documentation</a> »</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|