quickstart.rst 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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
  5. ==========
  6. Getting a demo up and running
  7. =============================
  8. Use the content delivery network
  9. --------------------------------
  10. Converse.js has a `CDN <https://en.wikipedia.org/wiki/Content_delivery_network>`_, provided by `KeyCDN <http://keycdn.com/>`_,
  11. which hosts its Javascript and CSS files.
  12. The latest versions of these files are available at these URLs:
  13. * https://cdn.conversejs.org/dist/converse.min.js
  14. * https://cdn.conversejs.org/css/converse.min.css
  15. To load a specific version of Converse.js you can put the version in the URL, like so:
  16. * https://cdn.conversejs.org/1.0.3/dist/converse.min.js
  17. * https://cdn.conversejs.org/1.0.3/css/converse.min.css
  18. You can include these two URLs inside the *<head>* element of your website via the *script* and *link* tags:
  19. .. code-block:: html
  20. <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/css/converse.min.css">
  21. <script src="https://cdn.conversejs.org/dist/converse.min.js"></script>
  22. Initializing Converse.js
  23. ------------------------
  24. You'll then need to initialize Converse.js with configuration settings relevant to your requirements.
  25. Refer to the :ref:`configuration-variables` section for info on all the available configuration settings.
  26. To quickly get started, you can put the following Javascript code at the
  27. bottom of your page (after the closing *</body>* element):
  28. .. code-block:: javascript
  29. <script>
  30. require(['converse'], function (converse) {
  31. converse.initialize({
  32. bosh_service_url: 'https://bind.conversejs.org', // Please use this connection manager only for testing purposes
  33. show_controlbox_by_default: true,
  34. play_sounds: true,
  35. });
  36. });
  37. </script>
  38. The `index.html <https://github.com/jcbrand/converse.js/blob/master/index.html>`_ file inside the
  39. Converse.js repository may serve as a nice usable example.
  40. Alternative builds of Converse.js
  41. =================================
  42. The minified ``.js`` and ``.css`` files provide the same functionality as is available
  43. on the `conversejs.org <http://conversejs.org>`_ website. Useful for testing or demoing.
  44. Alternative builds are however also available via the CDN.
  45. Mobile build
  46. ------------
  47. Besides the default build mentioned above, there is a build intended for mobile
  48. websites, called ``converse-mobile.min.js``.
  49. Take a look at the ``mobile.html`` file in the Converse.js repository
  50. for an example of this build being used. There's an additional CSS file called
  51. ``mobile.min.css`` which should be used with the mobile build.
  52. When you load `conversejs.org <https://conversejs.org>`_ with a mobile device
  53. then the mobile Javascript build and its CSS will be used.
  54. Excluding 3rd party dependencies
  55. --------------------------------
  56. Then there is also a build that contains no 3rd party dependencies, called
  57. ``converse-no-dependencies.min.js`` and which is used in the ``non_amd.html``
  58. page in the repository.
  59. Excluding only jQuery
  60. ---------------------
  61. Lastly there is a build called ``converse.nojquery.min.js`` which excludes only
  62. jQuery but still includes all other 3rd party dependencies.
  63. Where to go from here?
  64. ======================
  65. You might want to implement some kind of persistent single-session solution for
  66. your website, where users authenticate once in your website and are then
  67. automatically logged in to the XMPP server as well. For more info on how this
  68. can be achieved, read: :ref:`session-support`.
  69. Perhaps you want to create your own custom build of Converse.js? Then head over
  70. to the :doc:`builds` section, or more generally the :doc:`development`
  71. documentation.
  72. Do you want to know how to theme Converse.js? Then read the :doc:`theming`
  73. documentation.