quickstart.rst 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. .. raw:: html
  2. <div id="banner"><a href="https://github.com/jcbrand/converse.js/blob/master/docs/source/quickstart.rst">Edit me on GitHub</a></div>
  3. =========================================
  4. Quickstart (to get a demo up and running)
  5. =========================================
  6. Converse.js has a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network), provided by [KeyCDN](http://keycdn.com/), which hosts its Javascript and CSS files.
  7. The latest versions of these files are available at these URLs:
  8. * https://cdn.conversejs.org/dist/converse.min.js
  9. * https://cdn.conversejs.org/css/converse.min.css
  10. For a specific version of the files, you can put the version in the URL, as so:
  11. * https://cdn.conversejs.org/1.0.3/dist/converse.min.js
  12. * https://cdn.conversejs.org/1.0.3/css/converse.min.css
  13. You can include these two URLs inside the *<head>* element of your website via the *script* and *link* tags:
  14. .. code-block:: html
  15. <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/css/converse.min.css">
  16. <script src="https://cdn.conversejs.org/dist/converse.min.js"></script>
  17. You need to initialize Converse.js with configuration settings according to your requirements.
  18. Please refer to the :ref:`configuration-variables` section for info on all the available configuration settings.
  19. To configure and initialize Converse.js, put the following inline Javascript code at the
  20. bottom of your page (after the closing *</body>* element).
  21. .. code-block:: javascript
  22. <script>
  23. require(['converse'], function (converse) {
  24. converse.initialize({
  25. bosh_service_url: 'https://bind.conversejs.org', // Please use this connection manager only for testing purposes
  26. i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported
  27. show_controlbox_by_default: true,
  28. roster_groups: true
  29. });
  30. });
  31. </script>
  32. The `index.html <https://github.com/jcbrand/converse.js/blob/master/index.html>`_ file inside the
  33. Converse.js repository may serve as a nice usable example.
  34. These minified `.js` and `.css` files provide the same demo-like functionality as is available
  35. on the `conversejs.org <http://conversejs.org>`_ website. Useful for testing or demoing.
  36. You'll most likely want to implement some kind of persistent single-session solution for
  37. your website, where users authenticate once in your website and then stay
  38. logged in to their XMPP session upon the next page reload.
  39. For more info on this, read: :ref:`session-support`.
  40. You might also want to have more fine-grained control of what gets included in
  41. the minified Javascript file. Read :doc:`builds` for more info on how to do that.