xmpp.chapril.org-conversejs/docs/source/quickstart.rst

99 lines
3.6 KiB
ReStructuredText
Raw Normal View History

.. raw:: html
<div id="banner"><a href="https://github.com/jcbrand/converse.js/blob/master/docs/source/quickstart.rst">Edit me on GitHub</a></div>
2016-12-22 14:00:03 +01:00
==========
Quickstart
==========
Getting a demo up and running
=============================
Use the content delivery network
--------------------------------
2018-09-18 10:53:43 +02:00
Converse has a `CDN <https://en.wikipedia.org/wiki/Content_delivery_network>`_, provided by `KeyCDN <http://keycdn.com/>`_,
2017-09-03 22:12:17 +02:00
which hosts its JavaScript and CSS files.
2016-06-21 09:07:22 +02:00
The latest versions of these files are available at these URLs:
2016-06-21 09:07:22 +02:00
* https://cdn.conversejs.org/dist/converse.min.js
* https://cdn.conversejs.org/css/converse.min.css
2018-09-18 10:53:43 +02:00
It's however recommended that you load a specific version of Converse, to avoid
breakage when a new version is released and the above URLs load new resources.
To load a specific version of Converse you can put the version in the URL, like so:
2016-06-21 09:07:22 +02:00
2018-10-22 11:41:40 +02:00
* https://cdn.conversejs.org/4.0.3/dist/converse.min.js
* https://cdn.conversejs.org/4.0.3/css/converse.min.css
You can include these two URLs inside the *<head>* element of your website
via the *script* and *link* tags:
2016-06-21 09:07:22 +02:00
.. code-block:: html
2016-06-21 09:07:22 +02:00
<link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/css/converse.min.css">
<script src="https://cdn.conversejs.org/dist/converse.min.js" charset="utf-8"></script>
2018-09-18 10:53:43 +02:00
.. note:: Instead of always loading the latest version of Converse via the
CDN, it's generally better to load a specific version (preferably the
latest one), to avoid breakage when new backwards-incompatible versions are
released.
2018-09-18 10:53:43 +02:00
Initializing Converse
---------------------
2018-09-18 10:53:43 +02:00
You'll then need to initialize Converse with configuration settings relevant to your requirements.
Refer to the :ref:`configuration-settings` section for info on all the available configuration settings.
2017-09-03 22:12:17 +02:00
To quickly get started, you can put the following JavaScript code at the
bottom of your page (after the closing *</body>* element)::
2015-06-22 14:47:53 +02:00
<script>
converse.initialize({
2017-11-17 19:20:42 +01:00
bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes
show_controlbox_by_default: true
});
2015-06-22 14:47:53 +02:00
</script>
The `index.html <https://github.com/jcbrand/converse.js/blob/master/index.html>`_ file inside the
2018-09-18 10:53:43 +02:00
Converse repository may serve as a nice usable example.
2018-01-09 15:49:45 +01:00
Fullscreen version
------------------
2018-09-18 10:53:43 +02:00
Converse also comes in a fullscreen version.
A hosted version is available online at `conversejs.org/fullscreen <https://conversejs.org/fullscreen.html>`_.
2018-01-09 15:49:45 +01:00
Originally this version was available as a separate build file, but
as of version 4.0.0 and higher, the difference between the "overlay" and the
"fullscreen" versions of converse.js is simply a matter of configuring the
:ref:`view_mode`.
2018-01-09 15:49:45 +01:00
2018-09-18 10:53:43 +02:00
For example::
2016-12-22 14:00:03 +01:00
2018-09-18 10:53:43 +02:00
<script>
converse.initialize({
bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes
view_mode: 'fullscreen'
});
</script>
2016-12-22 14:00:03 +01:00
Where to go from here?
======================
You might want to implement some kind of persistent single-session solution for
your website, where users authenticate once in your website and are then
automatically logged in to the XMPP server as well. For more info on how this
can be achieved, read: :ref:`session-support`.
2018-09-18 10:53:43 +02:00
Perhaps you want to create your own custom build of Converse? Then head over
2016-12-22 14:00:03 +01:00
to the :doc:`builds` section, or more generally the :doc:`development`
documentation.
2018-09-18 10:53:43 +02:00
Do you want to know how to theme Converse? Then read the :doc:`theming`
2016-12-22 14:00:03 +01:00
documentation.