2
0

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