2
0

quickstart.rst 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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/3.3.4/dist/converse.min.js
  17. * https://cdn.conversejs.org/3.3.4/css/converse.min.css
  18. You can include these two URLs inside the *<head>* element of your website
  19. via the *script* and *link* tags:
  20. .. code-block:: html
  21. <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/css/converse.min.css">
  22. <script src="https://cdn.conversejs.org/dist/converse.min.js" charset="utf-8"></script>
  23. .. note:: For the fullscreen :ref:`view_mode` version of converse.js, replace ``converse.min.css`` with ``inverse.min.css``.
  24. .. note:: Instead of always loading the latest version of Converse.js via the
  25. CDN, it's generally better to load a specific version (preferably the
  26. latest one), to avoid breakage when new backwards-incompatible versions are
  27. released.
  28. Initializing Converse.js
  29. ------------------------
  30. You'll then need to initialize Converse.js with configuration settings relevant to your requirements.
  31. Refer to the :ref:`configuration-settings` section for info on all the available configuration settings.
  32. To quickly get started, you can put the following JavaScript code at the
  33. bottom of your page (after the closing *</body>* element)::
  34. <script>
  35. converse.initialize({
  36. bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes
  37. show_controlbox_by_default: true
  38. });
  39. </script>
  40. The `index.html <https://github.com/jcbrand/converse.js/blob/master/index.html>`_ file inside the
  41. Converse.js repository may serve as a nice usable example.
  42. Alternative builds of Converse.js
  43. =================================
  44. The minified ``.js`` and ``.css`` files provide the same functionality as is available
  45. on the `conversejs.org <https://conversejs.org>`_ website. Useful for testing or demoing.
  46. Converse.js is composed out of plugins, and you are able to exclude certain
  47. plugins (and to include your own new plugins) when creating a build. This
  48. enables you to create your own custom builds of Converse.js that differ from
  49. the standard one.
  50. Besides the standard build, the Converse.js repository includes configuration
  51. for certain other non-standard builds, which we'll now mention below.
  52. Mobile version
  53. --------------
  54. Besides the default build mentioned above, there is a build intended for mobile
  55. websites, called ``converse-mobile.min.js``.
  56. Take a look at the ``mobile.html`` file in the Converse.js repository
  57. for an example of this build being used. There's an additional CSS file called
  58. ``mobile.min.css`` which should be used with the mobile build.
  59. When you load `conversejs.org <https://conversejs.org>`_ with a mobile device
  60. then the mobile JavaScript build and its CSS will be used.
  61. Excluding all 3rd party dependencies
  62. ------------------------------------
  63. Then there is also a build that contains no 3rd party dependencies, called
  64. ``converse-no-dependencies.min.js`` and which is used in the ``non_amd.html``
  65. page in the repository.
  66. Headless build
  67. --------------
  68. There is also the option of making a headless build of converse.js.
  69. This means a build without any UI but still containing core functionality of
  70. maintaining a roster, chatboxes and messages.
  71. The file `src/headless.js <https://github.com/jcbrand/converse.js/blob/master/src/headless.js>`_
  72. is used to determine which plugins are included in the build.
  73. Unfortunately it's currently not yet possible to include Multi-user chat (MUC)
  74. functionality in the headless build. This is because both the UI and core
  75. functionality is still contained in one plugin and would first need to be
  76. split up into two parts, with the UI part dropped for this build.
  77. Fullscreen version
  78. ------------------
  79. Converse.js also comes in a fullscreen version (often referred to as Inverse).
  80. A hosted version is available online at `inverse.chat <https://inverse.chat>`_.
  81. Originally this version was available as a separate build file, but
  82. as of version 4.0.0 and higher, the difference between the "overlay" and the
  83. "fullscreen" versions of converse.js is simply a matter of configuring the
  84. :ref:`view_mode` and including the right CSS file.
  85. For the default "overlay" version, ``converse.css`` is used, and for the
  86. "fullscreen" version ``inverse.css`` is used.
  87. We'd like to eventually not require two different CSS files, and to allow you
  88. to seamlessly switch between the different view modes.
  89. To generate the headless build, run ``make dist/converse-headless.js`` and/or
  90. ``make dist/converse-headless.min.js``.
  91. Where to go from here?
  92. ======================
  93. You might want to implement some kind of persistent single-session solution for
  94. your website, where users authenticate once in your website and are then
  95. automatically logged in to the XMPP server as well. For more info on how this
  96. can be achieved, read: :ref:`session-support`.
  97. Perhaps you want to create your own custom build of Converse.js? Then head over
  98. to the :doc:`builds` section, or more generally the :doc:`development`
  99. documentation.
  100. Do you want to know how to theme Converse.js? Then read the :doc:`theming`
  101. documentation.