configuration.rst 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377
  1. .. raw:: html
  2. <div id="banner"><a href="https://github.com/jcbrand/converse.js/blob/master/docs/source/configuration.rst">Edit me on GitHub</a></div>
  3. =============
  4. Configuration
  5. =============
  6. .. contents:: Table of Contents
  7. :depth: 2
  8. :local:
  9. The included minified JS and CSS files can be used for demoing or testing, but
  10. you'll want to configure *Converse.js* to suit your needs before you deploy it
  11. on your website.
  12. *Converse.js* is passed its configuration settings when you call its *initialize* method.
  13. You'll most likely want to call the *initialize* method in your HTML page. For
  14. an example of how this is done, please see the bottom of the *./index.html* page.
  15. Please refer to the `Configuration variables`_ section below for info on
  16. all the available configuration settings.
  17. After you have configured *Converse.js*, you'll have to regenerate the minified
  18. JS file so that it will include the new settings. Please refer to the
  19. :ref:`minification` section for more info on how to do this.
  20. .. _`configuration-variables`:
  21. Configuration variables
  22. =======================
  23. authentication
  24. --------------
  25. * Default: ``login``
  26. * Allowed values: `login`_, `external`, `anonymous`_, `prebind`_
  27. This option states the way converse.js will authenticate.
  28. login
  29. ~~~~~
  30. The default means is ``login``, which means that the user either logs in manually with their
  31. username and password, or automatically if used together with ``auto_login=true``
  32. and ``jid`` and ``password`` values. See `auto_login`_.
  33. external
  34. ~~~~~~~~
  35. This setting will still show a login form and submit button, but the form will
  36. only contain an input for the user's JID, *not* for the password.
  37. That's because this setting is intended to be used when you are using
  38. SASL-EXTERNAL as authentication mechanism, in which case a password is usually
  39. not required.
  40. SASL-EXTERNAL is generally used together with x509 client certificates to
  41. enable passwordless login or 2-factor authentication.
  42. For more details on this, `read this blog post <https://opkode.com/blog/strophe_converse_sasl_external/>`_.
  43. anonymous
  44. ~~~~~~~~~
  45. This enables anonymous login if the XMPP server supports it. This option can be
  46. used together with `auto_login`_ to automatically and anonymously log a user in
  47. as soon as the page loads.
  48. The server's domain is passed in via the `jid`_ setting.
  49. prebind
  50. ~~~~~~~
  51. See also: :ref:`session-support`
  52. Use this option when you want to attach to an existing XMPP
  53. `BOSH <https://en.wikipedia.org/wiki/BOSH>`_ session.
  54. Usually a BOSH session is set up server-side in your web app.
  55. Attaching to an existing BOSH session that was set up server-side is useful
  56. when you want to maintain a persistent single session for your users instead of
  57. requiring them to log in manually.
  58. When a BOSH session is initially created, you'll receive three tokens.
  59. A JID (jabber ID), SID (session ID) and RID (Request ID).
  60. Converse.js needs these tokens in order to attach to that same session.
  61. There are two complementary configuration settings to ``prebind``.
  62. They are :ref:`keepalive` and `prebind_url`_.
  63. ``keepalive`` can be used keep the session alive without having to pass in
  64. new RID and SID tokens to ``converse.initialize`` every time you reload the page.
  65. This removes the need to set up a new BOSH session every time a page loads.
  66. You do however still need to supply the user's JID so that converse.js can be
  67. sure that the session it's resuming is for the right user.
  68. `prebind_url`_ lets you specify a URL which converse.js will call whenever a
  69. new BOSH session needs to be set up.
  70. Here's an example of converse.js being initialized with these three options:
  71. .. code-block:: javascript
  72. converse.initialize({
  73. bosh_service_url: 'https://bind.example.com',
  74. keepalive: true,
  75. jid: 'me@example.com',
  76. authentication: 'prebind',
  77. prebind_url: 'http://example.com/api/prebind',
  78. allow_logout: false
  79. });
  80. allow_bookmarks
  81. ---------------
  82. * Default: ``true``
  83. Enables/disables chatroom bookmarks functionality.
  84. This setting is only applicable if the ``converse-bookmarks`` plugin is loaded.
  85. allow_chat_pending_contacts
  86. ---------------------------
  87. * Default: ``false``
  88. Allow the user to chat with pending contacts.
  89. allow_contact_removal
  90. ---------------------
  91. * Default: ``true``
  92. Allow the user to remove roster contacts by clicking on the delete icon
  93. (i.e. traschcan) next to a contact's name in the roster.
  94. allow_contact_requests
  95. ----------------------
  96. * Default: ``true``
  97. Allow users to add one another as contacts. If this is set to false, the
  98. **Add a contact** widget, **Contact Requests** and **Pending Contacts** roster
  99. sections will all not appear. Additionally, all incoming contact requests will be
  100. ignored.
  101. allow_dragresize
  102. ----------------
  103. * Default: ``true``
  104. Allow users to resize chats by dragging the edges. The min-height and min-width
  105. CSS properties set on a chat boxes (specifically on the ``#converse.js .chatbox > .box-flyout`` element)
  106. will be honored, IF they are set in pixels.
  107. allow_muc
  108. ---------
  109. * Default: ``true``
  110. Allow multi-user chat (muc) in chatrooms. Setting this to ``false`` will remove
  111. the ``Chatrooms`` tab from the control box.
  112. allow_muc_invitations
  113. ---------------------
  114. * Default: ``true``
  115. Allows users to be invited to join MUC chat rooms. An "Invite" widget will
  116. appear in the sidebar of the chat room where you can type in the JID of a user
  117. to invite into the chat room.
  118. allow_non_roster_messaging
  119. --------------------------
  120. * Default: ``false``
  121. Determines whether you'll receive messages from users that are not in your
  122. roster. The XMPP specification allows for this (similar to email).
  123. Setting this to `true` increases your chances of receiving spam (when using a
  124. federated server), while setting it to `false` means that people not on your
  125. roster can't contact you unless one (or both) of you subscribe to one another's
  126. presence (i.e. adding as a roster contact).
  127. allow_otr
  128. ---------
  129. * Default: ``true``
  130. Allow Off-the-record encryption of single-user chat messages.
  131. allow_registration
  132. ------------------
  133. * Default: ``true``
  134. Support for `XEP-0077: In band registration <http://xmpp.org/extensions/xep-0077.html>`_
  135. Allow XMPP account registration showing the corresponding UI register form interface.
  136. animate
  137. -------
  138. * Default: ``true``
  139. Show animations, for example when opening and closing chat boxes.
  140. archived_messages_page_size
  141. ---------------------------
  142. * Default: ``50``
  143. See also: `message_archiving`_
  144. This feature applies to `XEP-0313: Message Archive Management (MAM) <https://xmpp.org/extensions/xep-0313.html>`_
  145. and will only take effect if your server supports MAM.
  146. It allows you to specify the maximum amount of archived messages to be returned per query.
  147. When you open a chat box or room, archived messages will be displayed (if
  148. available) and the amount returned will be no more than the page size.
  149. You will be able to query for even older messages by scrolling upwards in the chat box or room
  150. (the so-called infinite scrolling pattern).
  151. auto_list_rooms
  152. ---------------
  153. * Default: ``false``
  154. If true, and the XMPP server on which the current user is logged in supports
  155. multi-user chat, then a list of rooms on that server will be fetched.
  156. Not recommended for servers with lots of chat rooms.
  157. For each room on the server a query is made to fetch further details (e.g.
  158. features, number of occupants etc.), so on servers with many rooms this
  159. option will create lots of extra connection traffic.
  160. auto_login
  161. ----------
  162. * Default: ``false``
  163. This option can be used to let converse.js automatically log the user in as
  164. soon as the page loads.
  165. It should be used either with ``authentication`` set to ``anonymous`` or to ``login``.
  166. If ``authentication`` is set to ``login``, then you will also need to provide a
  167. valid ``jid`` and ``password`` values, either manually by passing them in, or
  168. by the `credentials_url`_ setting. Setting a ``credentials_url`` is preferable
  169. to manually passing in ``jid`` and ``password`` values, because it allows
  170. better reconnection with ``auto_reconnect``. When the connection drops,
  171. converse.js will automatically fetch new login credentials from the
  172. ``credentials_url`` and reconnect.
  173. If ``authentication`` is set to ``anonymous``, then you will also need to provide the
  174. server's domain via the `jid`_ setting.
  175. This is a useful setting if you'd like to create a custom login form in your
  176. website. You'll need to write some Javascript to accept that custom form's
  177. login credentials, then you can pass those credentials (``jid`` and
  178. ``password``) to ``converse.initialize`` to start converse.js and log the user
  179. into their XMPP account.
  180. auto_away
  181. ---------
  182. * Default: ``0``
  183. The amount of seconds after which the user's presence status should
  184. automatically become ``away``.
  185. If the user's status is ``extended away``, it won't be changed to ``away``.
  186. If the given value is negative or ``0``, this option is disabled.
  187. auto_xa
  188. -------
  189. * Default: ``0``
  190. The amount of seconds after which the user's presence status should
  191. automatically become ``extended away``.
  192. If the value is negative or ``0``, the function is disabled.
  193. auto_reconnect
  194. --------------
  195. * Default: ``false``
  196. Automatically reconnect to the XMPP server if the connection drops
  197. unexpectedly.
  198. This option works best when you have `authentication` set to `prebind` and have
  199. also specified a `prebind_url` URL, from where converse.js can fetch the BOSH
  200. tokens. In this case, converse.js will automaticallly reconnect when the
  201. connection drops but also reestablish earlier lost connections (due to
  202. network outages, closing your laptop etc.).
  203. When `authentication` is set to `login`, then this option will only work when
  204. the page hasn't been reloaded yet, because then the user's password has been
  205. wiped from memory. This configuration can however still be useful when using
  206. converse.js in desktop apps, for example those based on `CEF <https://bitbucket.org/chromiumembedded/cef>`_
  207. or `electron <http://electron.atom.io/>`_.
  208. auto_subscribe
  209. --------------
  210. * Default: ``false``
  211. If true, the user will automatically subscribe back to any contact requests.
  212. auto_join_on_invite
  213. -------------------
  214. * Default: ``false``
  215. If true, the user will automatically join a chatroom on invite without any confirm.
  216. auto_join_rooms
  217. ---------------
  218. * Default: ``[]``
  219. This settings allows you to provide a list of groupchat conversations to be
  220. automatically joined once the user has logged in.
  221. You can either specify a simple list of room JIDs, in which case your nickname
  222. will be taken from your JID, or you can specify a list of maps, where each map
  223. specifies the room's JID and the nickname that should be used.
  224. For example::
  225. `[{'jid': 'room@example.org', 'nick': 'WizardKing69' }]`
  226. .. _`bosh-service-url`:
  227. bosh_service_url
  228. ----------------
  229. * Default: ``undefined``
  230. To connect to an XMPP server over HTTP you need a `BOSH <https://en.wikipedia.org/wiki/BOSH>`_
  231. connection manager which acts as a middle man between the HTTP and XMPP
  232. protocols.
  233. The bosh_service_url setting takes the URL of a BOSH connection manager.
  234. Please refer to your XMPP server's documentation on how to enable BOSH.
  235. For more information, read this blog post: `Which BOSH server do you need? <http://metajack.im/2008/09/08/which-bosh-server-do-you-need>`_
  236. A more modern alternative to BOSH is to use `websockets <https://developer.mozilla.org/en/docs/WebSockets>`_.
  237. Please see the :ref:`websocket-url` configuration setting.
  238. cache_otr_key
  239. -------------
  240. * Default: ``false``
  241. Let the `OTR (Off-the-record encryption) <https://otr.cypherpunks.ca>`_ private
  242. key be cached in your browser's session storage.
  243. The browser's session storage persists across page loads but is deleted once
  244. the tab or window is closed.
  245. If this option is set to ``false``, a new OTR private key will be generated
  246. for each page load. While more inconvenient, this is a much more secure option.
  247. This setting can only be used together with ``allow_otr = true``.
  248. .. note::
  249. A browser window's session storage is accessible by all javascript that
  250. is served from the same domain. So if there is malicious javascript served by
  251. the same server (or somehow injected via an attacker), then they will be able
  252. to retrieve your private key and read your all the chat messages in your
  253. current session. Previous sessions however cannot be decrypted.
  254. chatstate_notification_blacklist
  255. --------------------------------
  256. * Default: ``[]``
  257. A list of JIDs to be ignored when showing desktop notifications of changed chat states.
  258. Some user's clients routinely connect and disconnect (likely on mobile) and
  259. each time a chat state notificaion is received (``online`` when connecting and
  260. then ``offline`` when disconnecting).
  261. When desktop notifications are turned on (see `show-desktop-notifications`_),
  262. then you'll receive notification messages each time this happens.
  263. Receiving constant notifications that a user's client is connecting and disconnecting
  264. is annoying, so this option allows you to ignore those JIDs.
  265. connection_options
  266. ------------------
  267. * Default: ``{}``
  268. * Type: Object
  269. Converse.js relies on `Strophe.js <http://strophe.im>`_ to establish and
  270. maintain a connection to the XMPP server.
  271. This option allows you to pass a map of configuration options to be passed into
  272. the ``Strophe.Connection`` constructor.
  273. For documentation on the configuration options that ``Strophe.Connection``
  274. accepts, refer to the
  275. `Strophe.Connection documentation <http://strophe.im/strophejs/doc/1.2.8/files/strophe-js.html#Strophe.Connection.Strophe.Connection>`_.
  276. As an example, suppose you want to restrict the supported SASL authentication
  277. mechanisms, then you'd pass in the ``mechanisms`` as a ``connection_options``
  278. ``key:value`` pair:
  279. .. code-block:: javascript
  280. converse.initialize({
  281. connection_options: {
  282. 'mechanisms': [
  283. converse.env.Strophe.SASLMD5,
  284. ]
  285. },
  286. });
  287. .. _`credentials_url`:
  288. credentials_url
  289. ---------------
  290. * Default: ``null``
  291. * Type: URL
  292. This setting should be used in conjunction with ``authentication`` set to ``login`` and :ref:`keepalive` set to ``true``.
  293. It allows you to specify a URL which converse.js will call when it needs to get
  294. the username and password (or authentication token) which converse.js will use
  295. to automatically log the user in.
  296. If ``auto_reconnect`` is also set to true, then converse.js will automatically
  297. fetch new credentials from the ``credentials_url`` whenever the connection or
  298. session drops, and then attempt to reconnect and establish a new session.
  299. The server behind ``credentials_url`` should return a JSON encoded object::
  300. {
  301. "jid": "me@example.com/resource",
  302. "password": "Ilikecats!",
  303. }
  304. csi_waiting_time
  305. ----------------
  306. * Default: ``0``
  307. This option adds support for `XEP-0352 Client State Indication <http://xmpp.org/extensions/xep-0352.html>_`
  308. If converse.js is idle for the configured amount of seconds, a chat state
  309. indication of ``inactive`` will be sent out to the XMPP server (if the server
  310. supports CSI).
  311. Afterwards, ss soon as there is any activity (for example, the mouse moves),
  312. a chat state indication of ``active`` will be sent out.
  313. A value of ``0`` means that this feature is disabled.
  314. debug
  315. -----
  316. * Default: ``false``
  317. If set to true, debugging output will be logged to the browser console.
  318. default_domain
  319. --------------
  320. * Default: ``undefined``
  321. Specify a domain to act as the default for user JIDs. This allows users to log
  322. in with only the username part of their JID, instead of the full JID.
  323. For example, if ``default_domain`` is ``example.org``, then the user:
  324. ``johnny@example.org`` can log in with only ``johnny``.
  325. JIDs with other domains are still allowed but need to be provided in full.
  326. To specify only one domain and disallow other domains, see the `locked_domain`_
  327. option.
  328. registration_domain
  329. -------------------
  330. * Default: ``''``
  331. Specify a domain name for which the registration form will be fetched automatically,
  332. without the user having to enter any XMPP server domain name.
  333. default_state
  334. -------------
  335. * Default: ``'online'``
  336. The default chat status that the user wil have. If you for example set this to
  337. ``'chat'``, then converse.js will send out a presence stanza with ``"show"``
  338. set to ``'chat'`` as soon as you've been logged in.
  339. domain_placeholder
  340. ------------------
  341. * Default: ``e.g. conversejs.org``
  342. The placeholder text shown in the domain input on the registration form.
  343. expose_rid_and_sid
  344. ------------------
  345. * Default: ``false``
  346. Allow the prebind tokens, RID (request ID) and SID (session ID), to be exposed
  347. globally via the API. This allows other scripts served on the same page to use
  348. these values.
  349. *Beware*: a malicious script could use these tokens to assume your identity
  350. and inject fake chat messages.
  351. filter_by_resource
  352. ------------------
  353. * Default: ``false``
  354. Before version 1.0.3 converse.js would ignore received messages if they were
  355. intended for a different resource then the current user had. It was decided to
  356. drop this restriction but leave it configurable.
  357. forward_messages
  358. ----------------
  359. * Default: ``false``
  360. If set to ``true``, sent messages will also be forwarded to the sending user's
  361. bare JID (their Jabber ID independent of any chat clients aka resources).
  362. This means that sent messages are visible from all the user's chat clients,
  363. and not just the one from which it was actually sent.
  364. This is especially important for web chat, such as converse.js, where each
  365. browser tab functions as a separate chat client, with its own resource.
  366. This feature uses Stanza forwarding, see also `XEP 0297: Stanza Forwarding <http://www.xmpp.org/extensions/xep-0297.html>`_
  367. For an alternative approach, see also `message_carbons`_.
  368. fullname
  369. --------
  370. If you are using prebinding, can specify the fullname of the currently
  371. logged in user, otherwise the user's vCard will be fetched.
  372. .. _`hide_muc_server`:
  373. hide_muc_server
  374. ---------------
  375. * Default: ``false``
  376. Hide the ``server`` input field of the form inside the ``Room`` panel of the
  377. controlbox. Useful if you want to restrict users to a specific XMPP server of
  378. your choosing.
  379. hide_offline_users
  380. ------------------
  381. * Default: ``false``
  382. If set to ``true``, then don't show offline users.
  383. hide_open_bookmarks
  384. -------------------
  385. * Default: ``false``
  386. This setting applies to the ``converse-bookmarks`` plugin and specfically the
  387. list of bookmarks shown in the ``Rooms`` tab of the control box.
  388. By default all bookmarks are shown in that list, if this setting is set to
  389. ``true``, then only bookmarks for rooms not currently open (i.e. that the
  390. current user hasn't joined), are shown.
  391. Makes sense to set this to ``true`` when also using the non-core
  392. ``converse-roomslist`` plugin, which shows a list of currently open (i.e.
  393. "joined") rooms.
  394. include_offline_state
  395. ---------------------
  396. * Default: `false`
  397. Originally, converse.js included an `offline` state which the user could
  398. choose (along with `online`, `busy` and `away`).
  399. Eventually it was however decided to remove this state, since the `offline`
  400. state doesn't propagate across tabs like the others do.
  401. What's meant by "propagate across tabs", is that when you set the state to
  402. `offline` in one tab, and you have instances of converse.js open in other tabs
  403. in your browser, then those instances will not have their states changed to
  404. `offline` as well. For the other statees the change is however propagated.
  405. The reason for this is that according to the XMPP spec, there is no `offline`
  406. state. The only defined states are:
  407. * away -- The entity or resource is temporarily away.
  408. * chat -- The entity or resource is actively interested in chattiIng.
  409. * dnd -- The entity or resource is busy (dnd = "Do Not Disturb").
  410. * xa -- The entity or resource is away for an extended period (xa = "eXtended Away").
  411. Read the `relevant section in the XMPP spec <https://xmpp.org/rfcs/rfc6121.html#presence-syntax-children-show>`_
  412. for more info.
  413. What used to happen in converse.js when the `offline` state was chosen, is
  414. that a presence stanza with a `type` of `unavailable` was sent out.
  415. This is actually exactly what happens when you log out of converse.js as well,
  416. with the notable exception that in the `offline` state, the connection is not
  417. terminated. So you can at any time change your state to something else and
  418. start chatting again.
  419. This might be useful to people, however the fact that the `offline` state
  420. doesn't propagate across tabs means that the user experience is inconsistent,
  421. confusing and appears "broken".
  422. If you are however aware of this issue and still want to allow the `offline`
  423. state, then you can set this option to `true` to enable it.
  424. i18n
  425. ----
  426. * Default: Auto-detection of the User/Browser language
  427. If no locale is matching available locales, the default is ``en``.
  428. Specify the locale/language. The language must be in the ``locales`` object. Refer to
  429. ``./locale/locales.js`` to see which locales are supported.
  430. jid
  431. ---
  432. The Jabber ID or "JID" of the current user. The JID uniquely identifies a user
  433. on the XMPP network. It looks like an email address, but it's used for instant
  434. messaging instead.
  435. This value needs to be provided when using the :ref:`keepalive` option together
  436. with `prebind`_.
  437. .. _`keepalive`:
  438. keepalive
  439. ---------
  440. * Default: ``true``
  441. Determines whether Converse.js will maintain the chat session across page
  442. loads.
  443. This setting should also be used in conjunction with ``authentication`` set to `prebind`_.
  444. When using ``keepalive`` and ``prebind``, you will have to provide the `jid`_
  445. of the current user to ensure that a cached session is only resumed if it
  446. belongs to the current user.
  447. See also:
  448. * :ref:`session-support`
  449. .. note::
  450. Currently the "keepalive" setting only works with BOSH and not with
  451. websockets. This is because XMPP over websocket does not use the same
  452. session token as with BOSH. A possible solution for this is to implement
  453. `XEP-0198 <http://xmpp.org/extensions/xep-0198.html>`_, specifically
  454. with regards to "stream resumption".
  455. locked_domain
  456. -------------
  457. * Default: ``undefined``
  458. Similar to `default_domain`_ but no other domains are allowed.
  459. message_archiving
  460. -----------------
  461. * Default: ``undefined``
  462. Provides support for `XEP-0313: Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_,
  463. whereby messages are archived in the XMPP server for later retrieval.
  464. Note, your XMPP server must support XEP-0313 MAM for this to work.
  465. This option sets the default archiving preference.
  466. Valid values are ``undefined``, ``never``, ``always`` and ``roster``.
  467. ``undefined`` means that any existing MAM configuration, as set by the user or
  468. the server administrator, will be used.
  469. ``roster`` means that only messages to and from JIDs in your roster will be
  470. archived. The other two values are self-explanatory.
  471. message_archiving_timeout
  472. -------------------------
  473. * Default: ``8000``
  474. The amount of time (in milliseconds) to wait when requesting archived messages
  475. from the XMPP server.
  476. Used in conjunction with `message_archiving` and in context of `XEP-0313: Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_.
  477. message_carbons
  478. ---------------
  479. * Default: ``false``
  480. Support for `XEP-0280: Message Carbons <https://xmpp.org/extensions/xep-0280.html>`_
  481. In order to keep all IM clients for a user engaged in a conversation,
  482. outbound messages are carbon-copied to all interested resources.
  483. This is especially important in webchat, like converse.js, where each browser
  484. tab serves as a separate IM client.
  485. Both message_carbons and `forward_messages`_ try to solve the same problem
  486. (showing sent messages in all connected chat clients aka resources), but go about it
  487. in two different ways.
  488. Message carbons is the XEP (Jabber protocol extension) specifically drafted to
  489. solve this problem, while `forward_messages`_ uses
  490. `stanza forwarding <http://www.xmpp.org/extensions/xep-0297.html>`_
  491. message_storage
  492. ----------------
  493. * Default: ``session``
  494. Valid options: ``session``, ``local``.
  495. This option determines the type of `browser storage <https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage>`_
  496. (``localStorage`` or ``sessionStorage``) used by converse.js to cache messages (private and group).
  497. The main difference between the two is that `sessionStorage` only persists while
  498. the current tab or window containing a converse.js instance is open. As soon as
  499. it's closed, the data is cleared.
  500. Data in `localStorage` on the other hand is kept indefinitely, which can have
  501. privacy implications on public computers or when multiple people are using the
  502. same computer.
  503. See also the `storage`_ option, which applies to other cached data, such as
  504. which chats you have open, what features the XMPP server supports and what
  505. your online status is.
  506. muc_disable_moderator_commands
  507. ------------------------------
  508. * Default: ``false``
  509. Allows you to disable the moderator commands such as ``/kick`` or ``/ban``.
  510. muc_domain
  511. ----------
  512. * Default: ``undefined``
  513. The MUC (multi-user chat) domain that should be used. By default converse.js
  514. will attempt to get the MUC domain from the XMPP host of the currently logged in
  515. user.
  516. This setting will override that. You might want to combine this setting with `hide_muc_server`_.
  517. muc_history_max_stanzas
  518. -----------------------
  519. * Default: ``undefined``
  520. This option allows you to specify the maximum amount of messages to be shown in a
  521. chat room when you enter it. By default, the amount specified in the room
  522. configuration or determined by the server will be returned.
  523. Please note, this option is not related to
  524. `XEP-0313 Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_,
  525. which also allows you to show archived chat room messages, but follows a
  526. different approach.
  527. If you're using MAM for archiving chat room messages, you might want to set
  528. this option to zero.
  529. muc_instant_rooms
  530. ------------------
  531. * Default: ``true``
  532. Determines whether 'instant' (also called 'dynamic' in OpenFire) rooms are created.
  533. Otherwise rooms first have to be configured before they're available to other
  534. users (so-called "registered rooms" in `MUC-0045 <http://xmpp.org/extensions/xep-0045.html#createroom>`_).
  535. From a UX perspective, if this settings is `false`, then a configuration form will
  536. render, that has to be filled in first, before the room can be joined by other
  537. users.
  538. muc_nickname_from_jid
  539. ---------------------
  540. * Default: ``false``
  541. When set to ``true``, then users will not be prompted to provide nicknames for
  542. chat rooms. Instead, the node part of a user's JID (i.e. JID = node@domain/resource)
  543. will be used. If the user's nickname is already taken by another user in the
  544. chat room, then an integer will be added to make it unique.
  545. So, for example, if john@example.com joins a chatroom, his nickname will
  546. automatically be "john". If now john@differentdomain.com tries to join the
  547. room, his nickname will be "john-2", and if john@somethingelse.com joins, then
  548. his nickname will be "john-3", and so forth.
  549. muc_show_join_leave
  550. -------------------
  551. * Default; ``true``
  552. Determines whether Converse.js will show info messages inside a chat room
  553. whenever a user joins or leaves it.
  554. notify_all_room_messages
  555. ------------------------
  556. * Default: ``false``
  557. By default, sound and desktop notifications will only be made when you are
  558. mentioned in a room. If you set this setting to `true`, then you will be
  559. notified of all messages received in a room.
  560. You can also pass an array of room JIDs to this option, to only apply it to
  561. certain rooms.
  562. notification_icon
  563. -----------------
  564. * Default: ``'/logo/conversejs.png'``
  565. This option specifies which icon is shown in HTML5 notifications, as provided
  566. by the ``src/converse-notification.js`` plugin.
  567. ping_interval
  568. -------------
  569. * Default: ``180``
  570. Make ping to server in order to keep connection with server killing sessions after idle timeout.
  571. The ping are sent only if no messages are sent in the last ``ping_interval`` seconds
  572. You need to set the value to any positive value to enable this functionality.
  573. If you set this value to ``0`` or any negative value, il will disable this functionality.
  574. .. _`play-sounds`:
  575. play_sounds
  576. -----------
  577. * Default: ``false``
  578. Plays a notification sound when you receive a personal message or when your
  579. nickname is mentioned in a chat room.
  580. Inside the ``./sounds`` directory of the Converse.js repo you'll see MP3 and Ogg
  581. formatted sound files. We need both, because neither format is supported by all browsers.
  582. You can set the URL where the sound files are hosted with the `sounds_path`_
  583. option.
  584. Requires the `src/converse-notification.js` plugin.
  585. .. _`prebind_url`:
  586. prebind_url
  587. -----------
  588. * Default: ``null``
  589. * Type: URL
  590. See also: :ref:`session-support`
  591. This setting should be used in conjunction with ``authentication`` set to `prebind` and :ref:`keepalive` set to ``true``.
  592. It allows you to specify a URL which converse.js will call when it needs to get
  593. the RID and SID (Request ID and Session ID) tokens of a BOSH connection, which
  594. converse.js will then attach to.
  595. The server behind ``prebind_url`` should return a JSON encoded object with the
  596. three tokens::
  597. {
  598. "jid": "me@example.com/resource",
  599. "sid": "346234623462",
  600. "rid": "876987608760"
  601. }
  602. priority
  603. --------
  604. * Default: ``0``
  605. * Type: Number
  606. Determines the priority used for presence stanzas sent out from this resource
  607. (i.e. this instance of Converse.js).
  608. The priority of a given XMPP chat client determines the importance of its presence
  609. stanzas in relation to stanzas received from other clients of the same user.
  610. In Converse.js, the indicated chat status of a roster contact will be taken from the
  611. presence stanza (and associated resource) with the highest priority.
  612. If multiple resources have the same top priority, then the chat status will be
  613. taken from the most recent present stanza.
  614. For more info you can read `Section 2.2.2.3 of RFC-3921 <https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.2.2.3>`_.
  615. providers_link
  616. --------------
  617. * Default: ``https://xmpp.net/directory.php``
  618. The hyperlink on the registration form which points to a directory of public
  619. XMPP servers.
  620. roster_groups
  621. -------------
  622. * Default: ``false``
  623. If set to ``true``, converse.js will show any roster groups you might have
  624. configured.
  625. .. note::
  626. It's currently not possible to use converse.js to assign contacts to groups.
  627. Converse.js can only show users and groups that were previously configured
  628. elsewhere.
  629. show_chatstate_notifications
  630. ----------------------------
  631. * Default: ``false``
  632. Specifies whether chat state (online, dnd, away) HTML5 desktop notifications should be shown.
  633. show_controlbox_by_default
  634. --------------------------
  635. * Default: ``false``
  636. The "controlbox" refers to the special chatbox containing your contacts roster,
  637. status widget, chatrooms and other controls.
  638. By default this box is hidden and can be toggled by clicking on any element in
  639. the page with class *toggle-controlbox*.
  640. If this options is set to true, the controlbox will by default be shown upon
  641. page load.
  642. However, be aware that even if this value is set to ``false``, if the
  643. controlbox is open, and the page is reloaded, then it will stay open on the new
  644. page as well.
  645. .. _`show-desktop-notifications`:
  646. show_desktop_notifications
  647. --------------------------
  648. * Default: ``true``
  649. Should HTML5 desktop notifications be shown?
  650. Notification will be shown in the following cases:
  651. * the browser is not visible nor focused and a private message is received.
  652. * the browser is not visible nor focused and a groupchat message is received which mentions you.
  653. * `auto_subscribe` is set to `false` and a new contact request is received.
  654. Requires the `src/converse-notification.js` plugin.
  655. show_only_online_users
  656. ----------------------
  657. * Default: ``false``
  658. If set to ``true``, only online users will be shown in the contacts roster.
  659. Users with any other status (e.g. away, busy etc.) will not be shown.
  660. show_send_button
  661. ----------------------
  662. * Default: ``false``
  663. If set to ``true``, a button will be visible which can be clicked to send a message.
  664. sounds_path
  665. -----------
  666. * Default: ``/sounds/``
  667. This option only makes sense in conjunction with the `play_sounds`_ option and
  668. specifies the URL of the sound files to be played (exluding the file names
  669. themselves).
  670. In order to support all browsers we need both an MP3 and an Ogg file. Make sure
  671. to name your files ``msg_received.ogg`` and ``msg_received.mp3``.
  672. storage
  673. -------
  674. * Default: ``session``
  675. Valid options: ``session``, ``local``.
  676. This option determines the type of `browser storage <https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage>`_
  677. (``localStorage`` or ``sessionStorage``) used by converse.js to cache user data.
  678. Originally converse.js used only `localStorage`, however `sessionStorage` is from a
  679. privacy perspective a better choice.
  680. The main difference between the two is that `sessionStorage` only persists while
  681. the current tab or window containing a converse.js instance is open. As soon as
  682. it's closed, the data is cleared.
  683. Data in `localStorage` on the other hand is kept indefinitely.
  684. The data that is cached includes which chats you had open, what features the
  685. XMPP server supports and what your online status was.
  686. Since version 1.0.7, the store for messages is now configurable separately with
  687. the `message_storage`_ option, to allow you to cache messages for longer in the
  688. browser (with `localStorage`) while still using `sessionStorage` for other
  689. data.
  690. .. note::
  691. Between versions 0.8.0 and 1.0.7, setting the value of this option to "local"
  692. is not recommended. The statuses (online, away, busy etc.) of your roster
  693. contacts are cached in the browser storage. If you use local storage, these
  694. values are stored for multiple sessions, and they will likely become out of
  695. sync with your contacts' actual statuses. The session storage doesn't have
  696. this problem, because roster contact statuses will not become out of sync in
  697. a single session, only across more than one session.
  698. Since version 1.0.7, the "storage" option doesn't apply anymore to how roster
  699. contacts and their statuses are stored (they're now always stored in session
  700. storage), to address the above issue.
  701. sticky_controlbox
  702. -----------------
  703. * Default: ``false``
  704. If set to ``true``, the control box (which includes the login, registration,
  705. contacts and rooms tabs) will not be closeable. It won't have a close button at
  706. all.
  707. The idea behind this setting is to provide a better experience on mobile
  708. devices when the intent is to use converse.js as a web app. In this case
  709. it doesn't make sense to close the control box, as there's often then nothing
  710. "behind" it that's relevant to the user.
  711. .. _`strict_plugin_dependencies`:
  712. strict_plugin_dependencies
  713. --------------------------
  714. * Default: ``false``
  715. When set to ``true`` and a plugin tries to override an object which doesn't
  716. exist (for example because the plugin which provides that object is not
  717. loaded), then an error will be raised.
  718. Otherwise a message will simply be logged and the override instruction ignored.
  719. The Converse.js plugins architecture can have an ``optional_dependencies``
  720. plugin attribute. This enables you to specify an array of optional, or
  721. "soft", dependencies. Converse.js (more specifically,
  722. `pluggable.js <https://jcbrand.github.io/pluggable.js/>`_) will try to first
  723. load the optional dependencies before executing the plugin's overrides and
  724. calling its ``initialize`` method.
  725. If ``strict_plugin_dependencies`` is set to ``false`` it won't raise an error
  726. if the optional dependencies aren't found. If set to ``true`` these optional
  727. dependencies are treated as normal non-optional ones, which means that an error
  728. will be raised.
  729. synchronize_availability
  730. ------------------------
  731. * Default: ``true``
  732. Valid options: ``true``, ``false``, ``a resource name``.
  733. This option lets you synchronize your chat status (`online`, `busy`, `away`) with other chat clients. In other words,
  734. if you change your status to `busy` in a different chat client, your status will change to `busy` in converse.js as well.
  735. If set to ``true``, converse.js will synchronize with all other clients you are logged in with.
  736. If set to ``false``, this feature is disabled.
  737. If set to ``a resource name``, converse.js will synchronize only with a client that has that particular resource assigned to it.
  738. time_format
  739. -----------
  740. * Default: ``HH:mm``
  741. Examples: ``HH:mm``, ``hh:mm``, ``hh:mm a``.
  742. This option makes the time format for the time shown, for each message, configurable. Converse uses `moment.js <https://momentjs.com/>`_
  743. for showing time. This option allows the configuration of the format in which `moment` will display the time for the messages. For detailed
  744. description of time-format options available for `moment` you can check this `link <https://momentjs.com/docs/#/parsing/string-format/>`_.
  745. use_otr_by_default
  746. ------------------
  747. * Default: ``false``
  748. If set to ``true``, Converse.js will automatically try to initiate an OTR (off-the-record)
  749. encrypted chat session every time you open a chat box.
  750. use_vcards
  751. ----------
  752. * Default: ``true``
  753. Determines whether the XMPP server will be queried for roster contacts' VCards
  754. or not. VCards contain extra personal information such as your fullname and
  755. avatar image.
  756. visible_toolbar_buttons
  757. -----------------------
  758. * Default:
  759. .. code-block:: javascript
  760. {
  761. call: false,
  762. clear: true,
  763. emoticons: true,
  764. toggle_occupants: true
  765. }
  766. Allows you to show or hide buttons on the chat boxes' toolbars.
  767. * *call*:
  768. Provides a button with a picture of a telephone on it.
  769. When the call button is pressed, it will emit an event that can be used by a third-party library to initiate a call.
  770. .. code-block:: javascript
  771. converse.listen.on('callButtonClicked', function(data) {
  772. console.log('Strophe connection is', data.connection);
  773. console.log('Bare buddy JID is', data.model.get('jid'));
  774. // ... Third-party library code ...
  775. });
  776. * *clear*:
  777. Provides a button for clearing messages from a chat box.
  778. * *emoticons*:
  779. Enables rendering of emoticons and provides a toolbar button for choosing them.
  780. * toggle_occupants:
  781. Shows a button for toggling (i.e. showing/hiding) the list of occupants in a chat room.
  782. .. _`websocket-url`:
  783. websocket_url
  784. -------------
  785. * Default: ``undefined``
  786. This option is used to specify a
  787. `websocket <https://developer.mozilla.org/en/docs/WebSockets>`_ URI to which
  788. converse.js can connect to.
  789. Websockets provide a more modern and effective two-way communication protocol
  790. between the browser and a server, effectively emulating TCP at the application
  791. layer and therefore overcoming many of the problems with existing long-polling
  792. techniques for bidirectional HTTP (such as `BOSH <https://en.wikipedia.org/wiki/BOSH>`_).
  793. Please refer to your XMPP server's documentation on how to enable websocket
  794. support.
  795. .. note::
  796. Please note that not older browsers do not support websockets. For older
  797. browsers you'll want to specify a BOSH URL. See the :ref:`bosh-service-url`
  798. configuration setting).
  799. .. note::
  800. Converse.js does not yet support "keepalive" with websockets.
  801. blacklisted_plugins
  802. -------------------
  803. * Default: ``[]``
  804. A list of plugin names that are blacklisted and will therefore not be
  805. initialized once ``converse.initialize`` is called, even if the same plugin is
  806. whitelisted.
  807. From Converse.js 3.0 onwards most of the API is available only to plugins and
  808. all plugins need to be whitelisted first.
  809. The usecase for blacklisting is generally to disable removed core plugins
  810. (which are automatically whitelisted) to prevent other (potentially malicious)
  811. plugins from registering themselves under those names.
  812. The core, and by default whitelisted, plugins are::
  813. converse-bookmarks
  814. converse-chatview
  815. converse-controlbox
  816. converse-core
  817. converse-dragresize
  818. converse-headline
  819. converse-mam
  820. converse-minimize
  821. converse-muc
  822. converse-notification
  823. converse-otr
  824. converse-ping
  825. converse-register
  826. converse-rosterview
  827. converse-vcard
  828. An example from `the embedded room demo <https://conversejs.org/demo/embedded.html>`_
  829. .. code-block:: javascript
  830. require(['converse-core', 'converse-muc-embedded'], function (converse) {
  831. converse.initialize({
  832. // other settings removed for brevity
  833. blacklisted_plugins: [
  834. 'converse-controlbox',
  835. 'converse-dragresize',
  836. 'converse-minimize',
  837. 'converse-vcard'
  838. ],
  839. });
  840. });
  841. .. _`whitelisted_plugins`:
  842. whitelisted_plugins
  843. -------------------
  844. * Default: ``[]``
  845. A list of plugin names that are whitelisted and will therefore be
  846. initialized once ``converse.initialize`` is called.
  847. From Converse.js 3.0 onwards most of the API is available only to plugins and
  848. all plugins need to be whitelisted first.
  849. This is done to prevent malicious scripts from using the API to trick users or
  850. to read their conversations.
  851. By default all the core plugins are already whitelisted.
  852. These are::
  853. converse-bookmarks
  854. converse-chatview
  855. converse-controlbox
  856. converse-core
  857. converse-dragresize
  858. converse-headline
  859. converse-mam
  860. converse-minimize
  861. converse-muc
  862. converse-notification
  863. converse-otr
  864. converse-ping
  865. converse-register
  866. converse-rosterview
  867. converse-vcard
  868. If you are using a custom build which excludes some core plugins, then you
  869. should blacklist them so that malicious scripts can't register their own
  870. plugins under those names. See `blacklisted_plugins`_ for more info.
  871. An example from `the embedded room demo <https://conversejs.org/demo/embedded.html>`_
  872. .. code-block:: javascript
  873. require(['converse-core', 'converse-muc-embedded'], function (converse) {
  874. converse.initialize({
  875. // other settings removed for brevity
  876. whitelisted_plugins: ['converse-muc-embedded']
  877. });
  878. });
  879. xhr_custom_status
  880. -----------------
  881. * Default: ``false``
  882. .. note::
  883. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  884. This option will let converse.js make an AJAX POST with your changed custom chat status to a
  885. remote server.
  886. xhr_custom_status_url
  887. ---------------------
  888. .. note::
  889. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  890. * Default: Empty string
  891. Used only in conjunction with ``xhr_custom_status``.
  892. This is the URL to which the AJAX POST request to set the user's custom status
  893. message will be made.
  894. The message itself is sent in the request under the key ``msg``.
  895. xhr_user_search
  896. ---------------
  897. * Default: ``false``
  898. .. note::
  899. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  900. There are two ways to add users.
  901. * The user inputs a valid JID (Jabber ID), and the user is added as a pending contact.
  902. * The user inputs some text (for example part of a firstname or lastname), an XHR (Ajax Request) will be made to a remote server, and a list of matches are returned. The user can then choose one of the matches to add as a contact.
  903. This setting enables the second mechanism, otherwise by default the first will be used.
  904. *What is expected from the remote server?*
  905. A default JSON encoded list of objects must be returned. Each object
  906. corresponds to a matched user and needs the keys ``id`` and ``fullname``.
  907. .. code-block:: javascript
  908. [{"id": "foo", "fullname": "Foo McFoo"}, {"id": "bar", "fullname": "Bar McBar"}]
  909. .. note::
  910. Make sure your server script sets the header `Content-Type: application/json`.
  911. xhr_user_search_url
  912. -------------------
  913. .. note::
  914. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  915. * Default: Empty string
  916. Used only in conjunction with ``xhr_user_search``.
  917. This is the URL to which an XHR GET request will be made to fetch user data from your remote server.
  918. The query string will be included in the request with ``q`` as its key.
  919. The data returned must be a JSON encoded list of user JIDs.