quickstart.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. Option 1: Use the content delivery network
  9. ------------------------------------------
  10. Converse 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. It's however recommended that you load a specific version of Converse, to avoid
  16. breakage when a new version is released and the above URLs load new resources.
  17. To load a specific version of Converse you can put the version in the URL, like so:
  18. * https://cdn.conversejs.org/4.0.4/dist/converse.min.js
  19. * https://cdn.conversejs.org/4.0.4/css/converse.min.css
  20. You can include these two URLs inside the *<head>* element of your website
  21. via the *script* and *link* tags:
  22. .. code-block:: html
  23. <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/css/converse.min.css">
  24. <script src="https://cdn.conversejs.org/dist/converse.min.js" charset="utf-8"></script>
  25. .. note:: Instead of always loading the latest version of Converse via the
  26. CDN, it's generally better to load a specific version (preferably the
  27. latest one), to avoid breakage when new backwards-incompatible versions are
  28. released.
  29. Option 2: Building the files yourself
  30. -------------------------------------
  31. Instead of using the CDN, you can also create your own builds and host them
  32. yourself.
  33. Have a look at the :ref:`creating_builds` section on how to create your own
  34. builds.
  35. Long story short, you should be able to do it by running `make dist`, but you
  36. might need to install some development libraries on your system first
  37. (e.g. gcc, libffi-dev and ruby-dev).
  38. Besides including the ``converse.min.js`` and ``converse.min.css`` files,
  39. you'll also need to make sure that the ``webfonts`` directory is available in
  40. the same location as ``converse.min.css``.
  41. Initializing Converse
  42. ---------------------
  43. You'll then need to initialize Converse with configuration settings relevant to your requirements.
  44. Refer to the :ref:`configuration-settings` section for info on all the available configuration settings.
  45. To quickly get started, you can put the following JavaScript code at the
  46. bottom of your page (after the closing *</body>* element)::
  47. <script>
  48. converse.initialize({
  49. bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes
  50. show_controlbox_by_default: true
  51. });
  52. </script>
  53. The `index.html <https://github.com/jcbrand/converse.js/blob/master/index.html>`_ file inside the
  54. Converse repository may serve as a nice usable example.
  55. Fullscreen version
  56. ------------------
  57. Converse also comes in a fullscreen version.
  58. A hosted version is available online at `conversejs.org/fullscreen <https://conversejs.org/fullscreen.html>`_.
  59. Originally this version was available as a separate build file, but
  60. as of version 4.0.0 and higher, the difference between the "overlay" and the
  61. "fullscreen" versions of converse.js is simply a matter of configuring the
  62. :ref:`view_mode`.
  63. For example::
  64. <script>
  65. converse.initialize({
  66. bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes
  67. view_mode: 'fullscreen'
  68. });
  69. </script>
  70. Where to go from here?
  71. ======================
  72. You might want to implement some kind of persistent single-session solution for
  73. your website, where users authenticate once in your website and are then
  74. automatically logged in to the XMPP server as well. For more info on how this
  75. can be achieved, read: :ref:`session-support`.
  76. Perhaps you want to create your own custom build of Converse? Then head over
  77. to the :doc:`builds` section, or more generally the :doc:`development`
  78. documentation.
  79. Do you want to know how to theme Converse? Then read the :doc:`theming`
  80. documentation.