configuration.rst 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404
  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 settings`_ 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-settings`:
  21. Configuration settings
  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. emojione_image_path
  344. -------------------
  345. * Default: ``'https://cdn.jsdelivr.net/emojione/assets/' + emojioneVersion + '/png/'``
  346. When `use_emojione`_ is set to ``true``, then this is the URL from where PNG image files for
  347. displaying emojis will be fetched.
  348. expose_rid_and_sid
  349. ------------------
  350. * Default: ``false``
  351. Allow the prebind tokens, RID (request ID) and SID (session ID), to be exposed
  352. globally via the API. This allows other scripts served on the same page to use
  353. these values.
  354. *Beware*: a malicious script could use these tokens to assume your identity
  355. and inject fake chat messages.
  356. filter_by_resource
  357. ------------------
  358. * Default: ``false``
  359. Before version 1.0.3 converse.js would ignore received messages if they were
  360. intended for a different resource then the current user had. It was decided to
  361. drop this restriction but leave it configurable.
  362. forward_messages
  363. ----------------
  364. * Default: ``false``
  365. If set to ``true``, sent messages will also be forwarded to the sending user's
  366. bare JID (their Jabber ID independent of any chat clients aka resources).
  367. This means that sent messages are visible from all the user's chat clients,
  368. and not just the one from which it was actually sent.
  369. This is especially important for web chat, such as converse.js, where each
  370. browser tab functions as a separate chat client, with its own resource.
  371. This feature uses Stanza forwarding, see also `XEP 0297: Stanza Forwarding <http://www.xmpp.org/extensions/xep-0297.html>`_
  372. For an alternative approach, see also `message_carbons`_.
  373. fullname
  374. --------
  375. If you are using prebinding, can specify the fullname of the currently
  376. logged in user, otherwise the user's vCard will be fetched.
  377. .. _`hide_muc_server`:
  378. hide_muc_server
  379. ---------------
  380. * Default: ``false``
  381. Hide the ``server`` input field of the form inside the ``Room`` panel of the
  382. controlbox. Useful if you want to restrict users to a specific XMPP server of
  383. your choosing.
  384. hide_offline_users
  385. ------------------
  386. * Default: ``false``
  387. If set to ``true``, then don't show offline users.
  388. hide_open_bookmarks
  389. -------------------
  390. * Default: ``false`` (``true`` for inVerse).
  391. This setting applies to the ``converse-bookmarks`` plugin and specfically the
  392. list of bookmarks shown in the ``Rooms`` tab of the control box.
  393. By default all bookmarks are shown in that list, if this setting is set to
  394. ``true``, then only bookmarks for rooms not currently open (i.e. that the
  395. current user hasn't joined), are shown.
  396. Makes sense to set this to ``true`` when also using the non-core
  397. ``converse-roomslist`` plugin, which shows a list of currently open (i.e.
  398. "joined") rooms.
  399. include_offline_state
  400. ---------------------
  401. * Default: `false`
  402. Originally, converse.js included an `offline` state which the user could
  403. choose (along with `online`, `busy` and `away`).
  404. Eventually it was however decided to remove this state, since the `offline`
  405. state doesn't propagate across tabs like the others do.
  406. What's meant by "propagate across tabs", is that when you set the state to
  407. `offline` in one tab, and you have instances of converse.js open in other tabs
  408. in your browser, then those instances will not have their states changed to
  409. `offline` as well. For the other statees the change is however propagated.
  410. The reason for this is that according to the XMPP spec, there is no `offline`
  411. state. The only defined states are:
  412. * away -- The entity or resource is temporarily away.
  413. * chat -- The entity or resource is actively interested in chattiIng.
  414. * dnd -- The entity or resource is busy (dnd = "Do Not Disturb").
  415. * xa -- The entity or resource is away for an extended period (xa = "eXtended Away").
  416. Read the `relevant section in the XMPP spec <https://xmpp.org/rfcs/rfc6121.html#presence-syntax-children-show>`_
  417. for more info.
  418. What used to happen in converse.js when the `offline` state was chosen, is
  419. that a presence stanza with a `type` of `unavailable` was sent out.
  420. This is actually exactly what happens when you log out of converse.js as well,
  421. with the notable exception that in the `offline` state, the connection is not
  422. terminated. So you can at any time change your state to something else and
  423. start chatting again.
  424. This might be useful to people, however the fact that the `offline` state
  425. doesn't propagate across tabs means that the user experience is inconsistent,
  426. confusing and appears "broken".
  427. If you are however aware of this issue and still want to allow the `offline`
  428. state, then you can set this option to `true` to enable it.
  429. i18n
  430. ----
  431. * Default: Auto-detection of the User/Browser language
  432. If no locale is matching available locales, the default is ``en``.
  433. Specify the locale/language. The language must be in the ``locales`` object. Refer to
  434. ``./locale/locales.js`` to see which locales are supported.
  435. jid
  436. ---
  437. The Jabber ID or "JID" of the current user. The JID uniquely identifies a user
  438. on the XMPP network. It looks like an email address, but it's used for instant
  439. messaging instead.
  440. This value needs to be provided when using the :ref:`keepalive` option together
  441. with `prebind`_.
  442. .. _`keepalive`:
  443. keepalive
  444. ---------
  445. * Default: ``true``
  446. Determines whether Converse.js will maintain the chat session across page
  447. loads.
  448. This setting should also be used in conjunction with ``authentication`` set to `prebind`_.
  449. When using ``keepalive`` and ``prebind``, you will have to provide the `jid`_
  450. of the current user to ensure that a cached session is only resumed if it
  451. belongs to the current user.
  452. See also:
  453. * :ref:`session-support`
  454. .. note::
  455. Currently the "keepalive" setting only works with BOSH and not with
  456. websockets. This is because XMPP over websocket does not use the same
  457. session token as with BOSH. A possible solution for this is to implement
  458. `XEP-0198 <http://xmpp.org/extensions/xep-0198.html>`_, specifically
  459. with regards to "stream resumption".
  460. locked_domain
  461. -------------
  462. * Default: ``undefined``
  463. Similar to `default_domain`_ but no other domains are allowed.
  464. For example, if ``locked_domain`` is set to ``example.org``, then the user
  465. ``johnny@example.org`` can log in with only ``johnny``.
  466. Additionally, only users registered on the ``example.org`` host can log in, no
  467. other users are allowed to log in.
  468. message_archiving
  469. -----------------
  470. * Default: ``undefined``
  471. Provides support for `XEP-0313: Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_,
  472. whereby messages are archived in the XMPP server for later retrieval.
  473. Note, your XMPP server must support XEP-0313 MAM for this to work.
  474. This option sets the default archiving preference.
  475. Valid values are ``undefined``, ``never``, ``always`` and ``roster``.
  476. ``undefined`` means that any existing MAM configuration, as set by the user or
  477. the server administrator, will be used.
  478. ``roster`` means that only messages to and from JIDs in your roster will be
  479. archived. The other two values are self-explanatory.
  480. message_archiving_timeout
  481. -------------------------
  482. * Default: ``8000``
  483. The amount of time (in milliseconds) to wait when requesting archived messages
  484. from the XMPP server.
  485. Used in conjunction with `message_archiving` and in context of `XEP-0313: Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_.
  486. message_carbons
  487. ---------------
  488. * Default: ``false``
  489. Support for `XEP-0280: Message Carbons <https://xmpp.org/extensions/xep-0280.html>`_
  490. In order to keep all IM clients for a user engaged in a conversation,
  491. outbound messages are carbon-copied to all interested resources.
  492. This is especially important in webchat, like converse.js, where each browser
  493. tab serves as a separate IM client.
  494. Both message_carbons and `forward_messages`_ try to solve the same problem
  495. (showing sent messages in all connected chat clients aka resources), but go about it
  496. in two different ways.
  497. Message carbons is the XEP (Jabber protocol extension) specifically drafted to
  498. solve this problem, while `forward_messages`_ uses
  499. `stanza forwarding <http://www.xmpp.org/extensions/xep-0297.html>`_
  500. message_storage
  501. ----------------
  502. * Default: ``session``
  503. Valid options: ``session``, ``local``.
  504. This option determines the type of `browser storage <https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage>`_
  505. (``localStorage`` or ``sessionStorage``) used by converse.js to cache messages (private and group).
  506. The main difference between the two is that `sessionStorage` only persists while
  507. the current tab or window containing a converse.js instance is open. As soon as
  508. it's closed, the data is cleared.
  509. Data in `localStorage` on the other hand is kept indefinitely, which can have
  510. privacy implications on public computers or when multiple people are using the
  511. same computer.
  512. See also the `storage`_ option, which applies to other cached data, such as
  513. which chats you have open, what features the XMPP server supports and what
  514. your online status is.
  515. muc_disable_moderator_commands
  516. ------------------------------
  517. * Default: ``false``
  518. Allows you to disable the moderator commands such as ``/kick`` or ``/ban``.
  519. muc_domain
  520. ----------
  521. * Default: ``undefined``
  522. The MUC (multi-user chat) domain that should be used. By default converse.js
  523. will attempt to get the MUC domain from the XMPP host of the currently logged in
  524. user.
  525. This setting will override that. You might want to combine this setting with `hide_muc_server`_.
  526. muc_history_max_stanzas
  527. -----------------------
  528. * Default: ``undefined``
  529. This option allows you to specify the maximum amount of messages to be shown in a
  530. chat room when you enter it. By default, the amount specified in the room
  531. configuration or determined by the server will be returned.
  532. Please note, this option is not related to
  533. `XEP-0313 Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_,
  534. which also allows you to show archived chat room messages, but follows a
  535. different approach.
  536. If you're using MAM for archiving chat room messages, you might want to set
  537. this option to zero.
  538. muc_instant_rooms
  539. ------------------
  540. * Default: ``true``
  541. Determines whether 'instant' (also called 'dynamic' in OpenFire) rooms are created.
  542. Otherwise rooms first have to be configured before they're available to other
  543. users (so-called "registered rooms" in `MUC-0045 <http://xmpp.org/extensions/xep-0045.html#createroom>`_).
  544. From a UX perspective, if this settings is `false`, then a configuration form will
  545. render, that has to be filled in first, before the room can be joined by other
  546. users.
  547. muc_nickname_from_jid
  548. ---------------------
  549. * Default: ``false``
  550. When set to ``true``, then users will not be prompted to provide nicknames for
  551. chat rooms. Instead, the node part of a user's JID (i.e. JID = node@domain/resource)
  552. will be used. If the user's nickname is already taken by another user in the
  553. chat room, then an integer will be added to make it unique.
  554. So, for example, if john@example.com joins a chatroom, his nickname will
  555. automatically be "john". If now john@differentdomain.com tries to join the
  556. room, his nickname will be "john-2", and if john@somethingelse.com joins, then
  557. his nickname will be "john-3", and so forth.
  558. muc_show_join_leave
  559. -------------------
  560. * Default; ``true``
  561. Determines whether Converse.js will show info messages inside a chat room
  562. whenever a user joins or leaves it.
  563. notify_all_room_messages
  564. ------------------------
  565. * Default: ``false``
  566. By default, sound and desktop notifications will only be made when you are
  567. mentioned in a room. If you set this setting to `true`, then you will be
  568. notified of all messages received in a room.
  569. You can also pass an array of room JIDs to this option, to only apply it to
  570. certain rooms.
  571. notification_icon
  572. -----------------
  573. * Default: ``'/logo/conversejs.png'``
  574. This option specifies which icon is shown in HTML5 notifications, as provided
  575. by the ``src/converse-notification.js`` plugin.
  576. ping_interval
  577. -------------
  578. * Default: ``180``
  579. Make ping to server in order to keep connection with server killing sessions after idle timeout.
  580. The ping are sent only if no messages are sent in the last ``ping_interval`` seconds
  581. You need to set the value to any positive value to enable this functionality.
  582. If you set this value to ``0`` or any negative value, il will disable this functionality.
  583. .. _`play-sounds`:
  584. play_sounds
  585. -----------
  586. * Default: ``false``
  587. Plays a notification sound when you receive a personal message or when your
  588. nickname is mentioned in a chat room.
  589. Inside the ``./sounds`` directory of the Converse.js repo you'll see MP3 and Ogg
  590. formatted sound files. We need both, because neither format is supported by all browsers.
  591. You can set the URL where the sound files are hosted with the `sounds_path`_
  592. option.
  593. Requires the `src/converse-notification.js` plugin.
  594. .. _`prebind_url`:
  595. prebind_url
  596. -----------
  597. * Default: ``null``
  598. * Type: URL
  599. See also: :ref:`session-support`
  600. This setting should be used in conjunction with ``authentication`` set to `prebind` and :ref:`keepalive` set to ``true``.
  601. It allows you to specify a URL which converse.js will call when it needs to get
  602. the RID and SID (Request ID and Session ID) tokens of a BOSH connection, which
  603. converse.js will then attach to.
  604. The server behind ``prebind_url`` should return a JSON encoded object with the
  605. three tokens::
  606. {
  607. "jid": "me@example.com/resource",
  608. "sid": "346234623462",
  609. "rid": "876987608760"
  610. }
  611. priority
  612. --------
  613. * Default: ``0``
  614. * Type: Number
  615. Determines the priority used for presence stanzas sent out from this resource
  616. (i.e. this instance of Converse.js).
  617. The priority of a given XMPP chat client determines the importance of its presence
  618. stanzas in relation to stanzas received from other clients of the same user.
  619. In Converse.js, the indicated chat status of a roster contact will be taken from the
  620. presence stanza (and associated resource) with the highest priority.
  621. If multiple resources have the same top priority, then the chat status will be
  622. taken from the most recent present stanza.
  623. 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>`_.
  624. providers_link
  625. --------------
  626. * Default: ``https://xmpp.net/directory.php``
  627. The hyperlink on the registration form which points to a directory of public
  628. XMPP servers.
  629. roster_groups
  630. -------------
  631. * Default: ``false``
  632. If set to ``true``, converse.js will show any roster groups you might have
  633. configured.
  634. .. note::
  635. It's currently not possible to use converse.js to assign contacts to groups.
  636. Converse.js can only show users and groups that were previously configured
  637. elsewhere.
  638. show_chatstate_notifications
  639. ----------------------------
  640. * Default: ``false``
  641. Specifies whether chat state (online, dnd, away) HTML5 desktop notifications should be shown.
  642. show_controlbox_by_default
  643. --------------------------
  644. * Default: ``false`` (``true`` for inVerse)
  645. The "controlbox" refers to the special chatbox containing your contacts roster,
  646. status widget, chatrooms and other controls.
  647. By default this box is hidden and can be toggled by clicking on any element in
  648. the page with class *toggle-controlbox*.
  649. If this options is set to true, the controlbox will by default be shown upon
  650. page load.
  651. However, be aware that even if this value is set to ``false``, if the
  652. controlbox is open, and the page is reloaded, then it will stay open on the new
  653. page as well.
  654. .. _`show-desktop-notifications`:
  655. show_desktop_notifications
  656. --------------------------
  657. * Default: ``true``
  658. Should HTML5 desktop notifications be shown?
  659. Notification will be shown in the following cases:
  660. * the browser is not visible nor focused and a private message is received.
  661. * the browser is not visible nor focused and a groupchat message is received which mentions you.
  662. * `auto_subscribe` is set to `false` and a new contact request is received.
  663. Requires the `src/converse-notification.js` plugin.
  664. use_emojione
  665. ------------
  666. * Default: ``true``
  667. Determines whether `Emojione <https://www.emojione.com/>`_ should be used to
  668. render emojis. If set to ``false``, then rendering support will fall back to
  669. the operating system or browser (which might not support emoji).
  670. See also `emojione_image_path`_.
  671. show_only_online_users
  672. ----------------------
  673. * Default: ``false``
  674. If set to ``true``, only online users will be shown in the contacts roster.
  675. Users with any other status (e.g. away, busy etc.) will not be shown.
  676. show_send_button
  677. ----------------------
  678. * Default: ``false``
  679. If set to ``true``, a button will be visible which can be clicked to send a message.
  680. sounds_path
  681. -----------
  682. * Default: ``/sounds/``
  683. This option only makes sense in conjunction with the `play_sounds`_ option and
  684. specifies the URL of the sound files to be played (exluding the file names
  685. themselves).
  686. In order to support all browsers we need both an MP3 and an Ogg file. Make sure
  687. to name your files ``msg_received.ogg`` and ``msg_received.mp3``.
  688. storage
  689. -------
  690. * Default: ``session``
  691. Valid options: ``session``, ``local``.
  692. This option determines the type of `browser storage <https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage>`_
  693. (``localStorage`` or ``sessionStorage``) used by converse.js to cache user data.
  694. Originally converse.js used only `localStorage`, however `sessionStorage` is from a
  695. privacy perspective a better choice.
  696. The main difference between the two is that `sessionStorage` only persists while
  697. the current tab or window containing a converse.js instance is open. As soon as
  698. it's closed, the data is cleared.
  699. Data in `localStorage` on the other hand is kept indefinitely.
  700. The data that is cached includes which chats you had open, what features the
  701. XMPP server supports and what your online status was.
  702. Since version 1.0.7, the store for messages is now configurable separately with
  703. the `message_storage`_ option, to allow you to cache messages for longer in the
  704. browser (with `localStorage`) while still using `sessionStorage` for other
  705. data.
  706. .. note::
  707. Between versions 0.8.0 and 1.0.7, setting the value of this option to "local"
  708. is not recommended. The statuses (online, away, busy etc.) of your roster
  709. contacts are cached in the browser storage. If you use local storage, these
  710. values are stored for multiple sessions, and they will likely become out of
  711. sync with your contacts' actual statuses. The session storage doesn't have
  712. this problem, because roster contact statuses will not become out of sync in
  713. a single session, only across more than one session.
  714. Since version 1.0.7, the "storage" option doesn't apply anymore to how roster
  715. contacts and their statuses are stored (they're now always stored in session
  716. storage), to address the above issue.
  717. sticky_controlbox
  718. -----------------
  719. * Default: ``false`` (``true`` for inVerse).
  720. If set to ``true``, the control box (which includes the login, registration,
  721. contacts and rooms tabs) will not be closeable. It won't have a close button at
  722. all.
  723. The idea behind this setting is to provide a better experience on mobile
  724. devices when the intent is to use converse.js as a web app. In this case
  725. it doesn't make sense to close the control box, as there's often then nothing
  726. "behind" it that's relevant to the user.
  727. .. _`strict_plugin_dependencies`:
  728. strict_plugin_dependencies
  729. --------------------------
  730. * Default: ``false``
  731. When set to ``true`` and a plugin tries to override an object which doesn't
  732. exist (for example because the plugin which provides that object is not
  733. loaded), then an error will be raised.
  734. Otherwise a message will simply be logged and the override instruction ignored.
  735. The Converse.js plugins architecture can have an :ref:`optional_dependencies`
  736. plugin attribute. This enables you to specify an array of optional, or
  737. "soft", dependencies. Converse.js (more specifically,
  738. `pluggable.js <https://jcbrand.github.io/pluggable.js/>`_) will try to first
  739. load the optional dependencies before executing the plugin's overrides and
  740. calling its ``initialize`` method.
  741. If ``strict_plugin_dependencies`` is set to ``false`` it won't raise an error
  742. if the optional dependencies aren't found. If set to ``true`` these optional
  743. dependencies are treated as normal non-optional ones, which means that an error
  744. will be raised.
  745. synchronize_availability
  746. ------------------------
  747. * Default: ``true``
  748. Valid options: ``true``, ``false``, ``a resource name``.
  749. This option lets you synchronize your chat status (`online`, `busy`, `away`) with other chat clients. In other words,
  750. if you change your status to `busy` in a different chat client, your status will change to `busy` in converse.js as well.
  751. If set to ``true``, converse.js will synchronize with all other clients you are logged in with.
  752. If set to ``false``, this feature is disabled.
  753. If set to ``a resource name``, converse.js will synchronize only with a client that has that particular resource assigned to it.
  754. time_format
  755. -----------
  756. * Default: ``HH:mm``
  757. Examples: ``HH:mm``, ``hh:mm``, ``hh:mm a``.
  758. This option makes the time format for the time shown, for each message, configurable. Converse uses `moment.js <https://momentjs.com/>`_
  759. for showing time. This option allows the configuration of the format in which `moment` will display the time for the messages. For detailed
  760. description of time-format options available for `moment` you can check this `link <https://momentjs.com/docs/#/parsing/string-format/>`_.
  761. use_otr_by_default
  762. ------------------
  763. * Default: ``false``
  764. If set to ``true``, Converse.js will automatically try to initiate an OTR (off-the-record)
  765. encrypted chat session every time you open a chat box.
  766. use_vcards
  767. ----------
  768. * Default: ``true``
  769. Determines whether the XMPP server will be queried for roster contacts' VCards
  770. or not. VCards contain extra personal information such as your fullname and
  771. avatar image.
  772. visible_toolbar_buttons
  773. -----------------------
  774. * Default:
  775. .. code-block:: javascript
  776. {
  777. call: false,
  778. clear: true,
  779. emoji: true,
  780. toggle_occupants: true
  781. }
  782. Allows you to show or hide buttons on the chat boxes' toolbars.
  783. * *call*:
  784. Provides a button with a picture of a telephone on it.
  785. When the call button is pressed, it will emit an event that can be used by a third-party library to initiate a call.
  786. .. code-block:: javascript
  787. converse.listen.on('callButtonClicked', function(data) {
  788. console.log('Strophe connection is', data.connection);
  789. console.log('Bare buddy JID is', data.model.get('jid'));
  790. // ... Third-party library code ...
  791. });
  792. * *clear*:
  793. Provides a button for clearing messages from a chat box.
  794. * *emoji*:
  795. Enables rendering of emoji and provides a toolbar button for choosing them.
  796. * *toggle_occupants*:
  797. Shows a button for toggling (i.e. showing/hiding) the list of occupants in a chat room.
  798. .. _`websocket-url`:
  799. websocket_url
  800. -------------
  801. * Default: ``undefined``
  802. This option is used to specify a
  803. `websocket <https://developer.mozilla.org/en/docs/WebSockets>`_ URI to which
  804. converse.js can connect to.
  805. Websockets provide a more modern and effective two-way communication protocol
  806. between the browser and a server, effectively emulating TCP at the application
  807. layer and therefore overcoming many of the problems with existing long-polling
  808. techniques for bidirectional HTTP (such as `BOSH <https://en.wikipedia.org/wiki/BOSH>`_).
  809. Please refer to your XMPP server's documentation on how to enable websocket
  810. support.
  811. .. note::
  812. Please note that not older browsers do not support websockets. For older
  813. browsers you'll want to specify a BOSH URL. See the :ref:`bosh-service-url`
  814. configuration setting).
  815. .. note::
  816. Converse.js does not yet support "keepalive" with websockets.
  817. blacklisted_plugins
  818. -------------------
  819. * Default: ``[]`` (``['converse-minimize', 'converse-dragresize']`` for inVerse)
  820. A list of plugin names that are blacklisted and will therefore not be
  821. initialized once ``converse.initialize`` is called, even if the same plugin is
  822. whitelisted.
  823. From Converse.js 3.0 onwards most of the API is available only to plugins and
  824. all plugins need to be whitelisted first.
  825. The usecase for blacklisting is generally to disable removed core plugins
  826. (which are automatically whitelisted) to prevent other (potentially malicious)
  827. plugins from registering themselves under those names.
  828. The core, and by default whitelisted, plugins are::
  829. converse-bookmarks
  830. converse-chatview
  831. converse-controlbox
  832. converse-core
  833. converse-dragresize
  834. converse-headline
  835. converse-mam
  836. converse-minimize
  837. converse-muc
  838. converse-notification
  839. converse-otr
  840. converse-ping
  841. converse-register
  842. converse-rosterview
  843. converse-vcard
  844. An example from `the embedded room demo <https://conversejs.org/demo/embedded.html>`_
  845. .. code-block:: javascript
  846. require(['converse-core', 'converse-muc-embedded'], function (converse) {
  847. converse.initialize({
  848. // other settings removed for brevity
  849. blacklisted_plugins: [
  850. 'converse-controlbox',
  851. 'converse-dragresize',
  852. 'converse-minimize',
  853. 'converse-vcard'
  854. ],
  855. });
  856. });
  857. .. _`whitelisted_plugins`:
  858. whitelisted_plugins
  859. -------------------
  860. * Default: ``[]``
  861. A list of plugin names that are whitelisted and will therefore be
  862. initialized once ``converse.initialize`` is called.
  863. From Converse.js 3.0 onwards most of the API is available only to plugins and
  864. all plugins need to be whitelisted first.
  865. This is done to prevent malicious scripts from using the API to trick users or
  866. to read their conversations.
  867. By default all the core plugins are already whitelisted.
  868. These are::
  869. converse-bookmarks
  870. converse-chatview
  871. converse-controlbox
  872. converse-core
  873. converse-dragresize
  874. converse-headline
  875. converse-mam
  876. converse-minimize
  877. converse-muc
  878. converse-notification
  879. converse-otr
  880. converse-ping
  881. converse-register
  882. converse-rosterview
  883. converse-vcard
  884. If you are using a custom build which excludes some core plugins, then you
  885. should blacklist them so that malicious scripts can't register their own
  886. plugins under those names. See `blacklisted_plugins`_ for more info.
  887. An example from `the embedded room demo <https://conversejs.org/demo/embedded.html>`_
  888. .. code-block:: javascript
  889. require(['converse-core', 'converse-muc-embedded'], function (converse) {
  890. converse.initialize({
  891. // other settings removed for brevity
  892. whitelisted_plugins: ['converse-muc-embedded']
  893. });
  894. });
  895. xhr_custom_status
  896. -----------------
  897. * Default: ``false``
  898. .. note::
  899. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  900. This option will let converse.js make an AJAX POST with your changed custom chat status to a
  901. remote server.
  902. xhr_custom_status_url
  903. ---------------------
  904. .. note::
  905. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  906. * Default: Empty string
  907. Used only in conjunction with ``xhr_custom_status``.
  908. This is the URL to which the AJAX POST request to set the user's custom status
  909. message will be made.
  910. The message itself is sent in the request under the key ``msg``.
  911. xhr_user_search
  912. ---------------
  913. * Default: ``false``
  914. .. note::
  915. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  916. There are two ways to add users.
  917. * The user inputs a valid JID (Jabber ID), and the user is added as a pending contact.
  918. * 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.
  919. This setting enables the second mechanism, otherwise by default the first will be used.
  920. *What is expected from the remote server?*
  921. A default JSON encoded list of objects must be returned. Each object
  922. corresponds to a matched user and needs the keys ``id`` and ``fullname``.
  923. .. code-block:: javascript
  924. [{"id": "foo", "fullname": "Foo McFoo"}, {"id": "bar", "fullname": "Bar McBar"}]
  925. .. note::
  926. Make sure your server script sets the header `Content-Type: application/json`.
  927. xhr_user_search_url
  928. -------------------
  929. .. note::
  930. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  931. * Default: Empty string
  932. Used only in conjunction with ``xhr_user_search``.
  933. This is the URL to which an XHR GET request will be made to fetch user data from your remote server.
  934. The query string will be included in the request with ``q`` as its key.
  935. The data returned must be a JSON encoded list of user JIDs.