quickstart.rst 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. When you download a specific release of *Converse.js* there will be two minified files inside the zip file.
  7. * dist/converse.js
  8. * css/converse.min.css
  9. You can include these two files inside the *<head>* element of your website via the *script* and *link* tags:
  10. .. code-block:: html
  11. <link rel="stylesheet" type="text/css" media="screen" href="css/converse.min.css">
  12. <script src="dist/converse.js"></script>
  13. .. note::
  14. Note that the Javascript file ``converse.js`` contains **all** the dependencies
  15. of converse.js and is unminified, so it's very large. Before you host
  16. converse.js yourself, you'll definitely want to generate a minified version
  17. first. There are various ways to do this. One option is to simply run ``make dist``,
  18. in your converse.js repo checkout. A minified file ``dist/converse.min.js`` will
  19. then be created for you, which you can use.
  20. You need to initialize Converse.js with configuration settings according to your requirements.
  21. Please refer to the :ref:`configuration-variables` section for info on all the available configuration settings.
  22. To configure and initialize Converse.js, put the following inline Javascript code at the
  23. bottom of your page (after the closing *</body>* element).
  24. .. code-block:: javascript
  25. <script>
  26. require(['converse'], function (converse) {
  27. converse.initialize({
  28. bosh_service_url: 'https://bind.conversejs.org', // Please use this connection manager only for testing purposes
  29. i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported
  30. show_controlbox_by_default: true,
  31. roster_groups: true
  32. });
  33. });
  34. </script>
  35. The `index.html <https://github.com/jcbrand/converse.js/blob/master/index.html>`_ file inside the
  36. Converse.js repository may serve as a nice usable example.
  37. These minified `.js` and `.css` files provide the same demo-like functionality as is available
  38. on the `conversejs.org <http://conversejs.org>`_ website. Useful for testing or demoing.
  39. You'll most likely want to implement some kind of persistent single-session solution for
  40. your website, where users authenticate once in your website and then stay
  41. logged in to their XMPP session upon the next page reload.
  42. For more info on this, read: :ref:`session-support`.
  43. You might also want to have more fine-grained control of what gets included in
  44. the minified Javascript file. Read :doc:`builds` for more info on how to do that.