configuration.rst 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280
  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: ``20``
  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.
  168. If ``authentication`` is set to ``anonymous``, then you will also need to provide the
  169. server's domain via the `jid`_ setting.
  170. This is a useful setting if you'd like to create a custom login form in your
  171. website. You'll need to write some Javascript to accept that custom form's
  172. login credentials, then you can pass those credentials (``jid`` and
  173. ``password``) to ``converse.initialize`` to start converse.js and log the user
  174. into their XMPP account.
  175. auto_away
  176. ---------
  177. * Default: ``0``
  178. The amount of seconds after which the user's presence status should
  179. automatically become ``away``.
  180. If the user's status is ``extended away``, it won't be changed to ``away``.
  181. If the given value is negative or ``0``, this option is disabled.
  182. auto_xa
  183. -------
  184. * Default: ``0``
  185. The amount of seconds after which the user's presence status should
  186. automatically become ``extended away``.
  187. If the value is negative or ``0``, the function is disabled.
  188. auto_reconnect
  189. --------------
  190. * Default: ``true``
  191. Automatically reconnect to the XMPP server if the connection drops
  192. unexpectedly.
  193. This option works best when you have `authentication` set to `prebind` and have
  194. also specified a `prebind_url` URL, from where converse.js can fetch the BOSH
  195. tokens. In this case, converse.js will automaticallly reconnect when the
  196. connection drops but also reestablish earlier lost connections (due to
  197. network outages, closing your laptop etc.).
  198. When `authentication` is set to `login`, then this option will only work when
  199. the page hasn't been reloaded yet, because then the user's password has been
  200. wiped from memory. This configuration can however still be useful when using
  201. converse.js in desktop apps, for example those based on `CEF <https://bitbucket.org/chromiumembedded/cef>`_
  202. or `electron <http://electron.atom.io/>`_.
  203. auto_subscribe
  204. --------------
  205. * Default: ``false``
  206. If true, the user will automatically subscribe back to any contact requests.
  207. auto_join_on_invite
  208. -------------------
  209. * Default: ``false``
  210. If true, the user will automatically join a chatroom on invite without any confirm.
  211. auto_join_rooms
  212. ---------------
  213. * Default: ``[]``
  214. This settings allows you to provide a list of groupchat conversations to be
  215. automatically joined once the user has logged in.
  216. You can either specify a simple list of room JIDs, in which case your nickname
  217. will be taken from your JID, or you can specify a list of maps, where each map
  218. specifies the room's JID and the nickname that should be used.
  219. For example::
  220. `[{'jid': 'room@example.org', 'nick': 'WizardKing69' }]`
  221. .. _`bosh-service-url`:
  222. bosh_service_url
  223. ----------------
  224. * Default: ``undefined``
  225. To connect to an XMPP server over HTTP you need a `BOSH <https://en.wikipedia.org/wiki/BOSH>`_
  226. connection manager which acts as a middle man between the HTTP and XMPP
  227. protocols.
  228. The bosh_service_url setting takes the URL of a BOSH connection manager.
  229. Please refer to your XMPP server's documentation on how to enable BOSH.
  230. 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>`_
  231. A more modern alternative to BOSH is to use `websockets <https://developer.mozilla.org/en/docs/WebSockets>`_.
  232. Please see the :ref:`websocket-url` configuration setting.
  233. cache_otr_key
  234. -------------
  235. * Default: ``false``
  236. Let the `OTR (Off-the-record encryption) <https://otr.cypherpunks.ca>`_ private
  237. key be cached in your browser's session storage.
  238. The browser's session storage persists across page loads but is deleted once
  239. the tab or window is closed.
  240. If this option is set to ``false``, a new OTR private key will be generated
  241. for each page load. While more inconvenient, this is a much more secure option.
  242. This setting can only be used together with ``allow_otr = true``.
  243. .. note::
  244. A browser window's session storage is accessible by all javascript that
  245. is served from the same domain. So if there is malicious javascript served by
  246. the same server (or somehow injected via an attacker), then they will be able
  247. to retrieve your private key and read your all the chat messages in your
  248. current session. Previous sessions however cannot be decrypted.
  249. chatstate_notification_blacklist
  250. --------------------------------
  251. * Default: ``[]``
  252. A list of JIDs to be ignored when showing desktop notifications of changed chat states.
  253. Some user's clients routinely connect and disconnect (likely on mobile) and
  254. each time a chat state notificaion is received (``online`` when connecting and
  255. then ``offline`` when disconnecting).
  256. When desktop notifications are turned on (see `show-desktop-notifications`_),
  257. then you'll receive notification messages each time this happens.
  258. Receiving constant notifications that a user's client is connecting and disconnecting
  259. is annoying, so this option allows you to ignore those JIDs.
  260. connection_options
  261. ------------------
  262. * Default: ``{}``
  263. * Type: Object
  264. Converse.js relies on `Strophe.js <http://strophe.im>`_ to establish and
  265. maintain a connection to the XMPP server.
  266. This option allows you to pass a map of configuration options to be passed into
  267. the ``Strophe.Connection`` constructor.
  268. For documentation on the configuration options that ``Strophe.Connection``
  269. accepts, refer to the
  270. `Strophe.Connection documentation <http://strophe.im/strophejs/doc/1.2.8/files/strophe-js.html#Strophe.Connection.Strophe.Connection>`_.
  271. As an example, suppose you want to restrict the supported SASL authentication
  272. mechanisms, then you'd pass in the ``mechanisms`` as a ``connection_options``
  273. ``key:value`` pair:
  274. .. code-block:: javascript
  275. converse.initialize({
  276. connection_options: {
  277. 'mechanisms': [
  278. converse.env.Strophe.SASLMD5,
  279. ]
  280. },
  281. });
  282. credentials_url
  283. ---------------
  284. * Default: ``null``
  285. * Type: URL
  286. This setting should be used in conjunction with ``authentication`` set to ``login`` and :ref:`keepalive` set to ``true``.
  287. It allows you to specify a URL which converse.js will call when it needs to get
  288. the username and password (or authentication token) which converse.js will use
  289. to automatically log the user in.
  290. The server behind ``credentials_url`` should return a JSON encoded object::
  291. {
  292. "jid": "me@example.com/resource",
  293. "password": "Ilikecats!",
  294. }
  295. csi_waiting_time
  296. ----------------
  297. * Default: ``0``
  298. This option adds support for `XEP-0352 Client State Indication <http://xmpp.org/extensions/xep-0352.html>_`
  299. If converse.js is idle for the configured amount of seconds, a chat state
  300. indication of ``inactive`` will be sent out to the XMPP server (if the server
  301. supports CSI).
  302. Afterwards, ss soon as there is any activity (for example, the mouse moves),
  303. a chat state indication of ``active`` will be sent out.
  304. A value of ``0`` means that this feature is disabled.
  305. debug
  306. -----
  307. * Default: ``false``
  308. If set to true, debugging output will be logged to the browser console.
  309. default_domain
  310. --------------
  311. * Default: ``undefined``
  312. Specify a domain to act as the default for user JIDs. This allows users to log
  313. in with only the username part of their JID, instead of the full JID.
  314. For example, if ``default_domain`` is ``example.org``, then the user:
  315. ``johnny@example.org`` can log in with only ``johnny``.
  316. JIDs with other domains are still allowed but need to be provided in full.
  317. To specify only one domain and disallow other domains, see the `locked_domain`_
  318. option.
  319. default_state
  320. -------------
  321. * Default: ``'online'``
  322. The default chat status that the user wil have. If you for example set this to
  323. ``'chat'``, then converse.js will send out a presence stanza with ``"show"``
  324. set to ``'chat'`` as soon as you've been logged in.
  325. domain_placeholder
  326. ------------------
  327. * Default: ``e.g. conversejs.org``
  328. The placeholder text shown in the domain input on the registration form.
  329. expose_rid_and_sid
  330. ------------------
  331. * Default: ``false``
  332. Allow the prebind tokens, RID (request ID) and SID (session ID), to be exposed
  333. globally via the API. This allows other scripts served on the same page to use
  334. these values.
  335. *Beware*: a malicious script could use these tokens to assume your identity
  336. and inject fake chat messages.
  337. filter_by_resource
  338. ------------------
  339. * Default: ``false``
  340. Before version 1.0.3 converse.js would ignore received messages if they were
  341. intended for a different resource then the current user had. It was decided to
  342. drop this restriction but leave it configurable.
  343. forward_messages
  344. ----------------
  345. * Default: ``false``
  346. If set to ``true``, sent messages will also be forwarded to the sending user's
  347. bare JID (their Jabber ID independent of any chat clients aka resources).
  348. This means that sent messages are visible from all the user's chat clients,
  349. and not just the one from which it was actually sent.
  350. This is especially important for web chat, such as converse.js, where each
  351. browser tab functions as a separate chat client, with its own resource.
  352. This feature uses Stanza forwarding, see also `XEP 0297: Stanza Forwarding <http://www.xmpp.org/extensions/xep-0297.html>`_
  353. For an alternative approach, see also `message_carbons`_.
  354. fullname
  355. --------
  356. If you are using prebinding, can specify the fullname of the currently
  357. logged in user, otherwise the user's vCard will be fetched.
  358. .. _`hide_muc_server`:
  359. hide_muc_server
  360. ---------------
  361. * Default: ``false``
  362. Hide the ``server`` input field of the form inside the ``Room`` panel of the
  363. controlbox. Useful if you want to restrict users to a specific XMPP server of
  364. your choosing.
  365. hide_offline_users
  366. ------------------
  367. * Default: ``false``
  368. If set to ``true``, then don't show offline users.
  369. include_offline_state
  370. ---------------------
  371. * Default: `false`
  372. Originally, converse.js included an `offline` state which the user could
  373. choose (along with `online`, `busy` and `away`).
  374. Eventually it was however decided to remove this state, since the `offline`
  375. state doesn't propagate across tabs like the others do.
  376. What's meant by "propagate across tabs", is that when you set the state to
  377. `offline` in one tab, and you have instances of converse.js open in other tabs
  378. in your browser, then those instances will not have their states changed to
  379. `offline` as well. For the other statees the change is however propagated.
  380. The reason for this is that according to the XMPP spec, there is no `offline`
  381. state. The only defined states are:
  382. * away -- The entity or resource is temporarily away.
  383. * chat -- The entity or resource is actively interested in chattiIng.
  384. * dnd -- The entity or resource is busy (dnd = "Do Not Disturb").
  385. * xa -- The entity or resource is away for an extended period (xa = "eXtended Away").
  386. Read the `relevant section in the XMPP spec <https://xmpp.org/rfcs/rfc6121.html#presence-syntax-children-show>`_
  387. for more info.
  388. What used to happen in converse.js when the `offline` state was chosen, is
  389. that a presence stanza with a `type` of `unavailable` was sent out.
  390. This is actually exactly what happens when you log out of converse.js as well,
  391. with the notable exception that in the `offline` state, the connection is not
  392. terminated. So you can at any time change your state to something else and
  393. start chatting again.
  394. This might be useful to people, however the fact that the `offline` state
  395. doesn't propagate across tabs means that the user experience is inconsistent,
  396. confusing and appears "broken".
  397. If you are however aware of this issue and still want to allow the `offline`
  398. state, then you can set this option to `true` to enable it.
  399. i18n
  400. ----
  401. * Default: Auto-detection of the User/Browser language
  402. If no locale is matching available locales, the default is ``en``.
  403. Specify the locale/language. The language must be in the ``locales`` object. Refer to
  404. ``./locale/locales.js`` to see which locales are supported.
  405. jid
  406. ---
  407. The Jabber ID or "JID" of the current user. The JID uniquely identifies a user
  408. on the XMPP network. It looks like an email address, but it's used for instant
  409. messaging instead.
  410. This value needs to be provided when using the :ref:`keepalive` option together
  411. with `prebind`_.
  412. .. _`keepalive`:
  413. keepalive
  414. ---------
  415. * Default: ``true``
  416. Determines whether Converse.js will maintain the chat session across page
  417. loads.
  418. This setting should also be used in conjunction with ``authentication`` set to `prebind`_.
  419. When using ``keepalive`` and ``prebind``, you will have to provide the `jid`_
  420. of the current user to ensure that a cached session is only resumed if it
  421. belongs to the current user.
  422. See also:
  423. * :ref:`session-support`
  424. .. note::
  425. Currently the "keepalive" setting only works with BOSH and not with
  426. websockets. This is because XMPP over websocket does not use the same
  427. session token as with BOSH. A possible solution for this is to implement
  428. `XEP-0198 <http://xmpp.org/extensions/xep-0198.html>`_, specifically
  429. with regards to "stream resumption".
  430. locked_domain
  431. -------------
  432. * Default: ``undefined``
  433. Similar to `default_domain`_ but no other domains are allowed.
  434. message_archiving
  435. -----------------
  436. * Default: ``undefined``
  437. Provides support for `XEP-0313: Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_,
  438. whereby messages are archived in the XMPP server for later retrieval.
  439. Note, your XMPP server must support XEP-0313 MAM for this to work.
  440. This option sets the default archiving preference.
  441. Valid values are ``undefined``, ``never``, ``always`` and ``roster``.
  442. ``undefined`` means that any existing MAM configuration, as set by the user or
  443. the server administrator, will be used.
  444. ``roster`` means that only messages to and from JIDs in your roster will be
  445. archived. The other two values are self-explanatory.
  446. message_archiving_timeout
  447. -------------------------
  448. * Default: ``8000``
  449. The amount of time (in milliseconds) to wait when requesting archived messages
  450. from the XMPP server.
  451. Used in conjunction with `message_archiving` and in context of `XEP-0313: Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_.
  452. message_carbons
  453. ---------------
  454. * Default: ``false``
  455. Support for `XEP-0280: Message Carbons <https://xmpp.org/extensions/xep-0280.html>`_
  456. In order to keep all IM clients for a user engaged in a conversation,
  457. outbound messages are carbon-copied to all interested resources.
  458. This is especially important in webchat, like converse.js, where each browser
  459. tab serves as a separate IM client.
  460. Both message_carbons and `forward_messages`_ try to solve the same problem
  461. (showing sent messages in all connected chat clients aka resources), but go about it
  462. in two different ways.
  463. Message carbons is the XEP (Jabber protocol extension) specifically drafted to
  464. solve this problem, while `forward_messages`_ uses
  465. `stanza forwarding <http://www.xmpp.org/extensions/xep-0297.html>`_
  466. message_storage
  467. ----------------
  468. * Default: ``session``
  469. Valid options: ``session``, ``local``.
  470. This option determines the type of `browser storage <https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage>`_
  471. (``localStorage`` or ``sessionStorage``) used by converse.js to cache messages (private and group).
  472. The main difference between the two is that `sessionStorage` only persists while
  473. the current tab or window containing a converse.js instance is open. As soon as
  474. it's closed, the data is cleared.
  475. Data in `localStorage` on the other hand is kept indefinitely, which can have
  476. privacy implications on public computers or when multiple people are using the
  477. same computer.
  478. See also the `storage`_ option, which applies to other cached data, such as
  479. which chats you have open, what features the XMPP server supports and what
  480. your online status is.
  481. muc_disable_moderator_commands
  482. ------------------------------
  483. * Default: ``false``
  484. Allows you to disable the moderator commands such as ``/kick`` or ``/ban``.
  485. muc_domain
  486. ----------
  487. * Default: ``undefined``
  488. The MUC (multi-user chat) domain that should be used. By default converse.js
  489. will attempt to get the MUC domain from the XMPP host of the currently logged in
  490. user.
  491. This setting will override that. You might want to combine this setting with `hide_muc_server`_.
  492. muc_history_max_stanzas
  493. -----------------------
  494. * Default: ``undefined``
  495. This option allows you to specify the maximum amount of messages to be shown in a
  496. chat room when you enter it. By default, the amount specified in the room
  497. configuration or determined by the server will be returned.
  498. Please note, this option is not related to
  499. `XEP-0313 Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_,
  500. which also allows you to show archived chat room messages, but follows a
  501. different approach.
  502. If you're using MAM for archiving chat room messages, you might want to set
  503. this option to zero.
  504. muc_instant_rooms
  505. ------------------
  506. * Default: ``true``
  507. Determines whether 'instant' (also called 'dynamic' in OpenFire) rooms are created.
  508. Otherwise rooms first have to be configured before they're available to other
  509. users (so-called "registered rooms" in `MUC-0045 <http://xmpp.org/extensions/xep-0045.html#createroom>`_).
  510. From a UX perspective, if this settings is `false`, then a configuration form will
  511. render, that has to be filled in first, before the room can be joined by other
  512. users.
  513. muc_nickname_from_jid
  514. ---------------------
  515. * Default: ``false``
  516. When set to ``true``, then users will not be prompted to provide nicknames for
  517. chat rooms. Instead, the node part of a user's JID (i.e. JID = node@domain/resource)
  518. will be used. If the user's nickname is already taken by another user in the
  519. chat room, then an integer will be added to make it unique.
  520. So, for example, if john@example.com joins a chatroom, his nickname will
  521. automatically be "john". If now john@differentdomain.com tries to join the
  522. room, his nickname will be "john-2", and if john@somethingelse.com joins, then
  523. his nickname will be "john-3", and so forth.
  524. notify_all_room_messages
  525. ------------------------
  526. * Default: ``false``
  527. By default, sound and desktop notifications will only be made when you are
  528. mentioned in a room. If you set this setting to `true`, then you will be
  529. notified of all messages received in a room.
  530. You can also pass an array of room JIDs to this option, to only apply it to
  531. certain rooms.
  532. notification_icon
  533. -----------------
  534. * Default: ``'/logo/conversejs.png'``
  535. This option specifies which icon is shown in HTML5 notifications, as provided
  536. by the ``src/converse-notification.js`` plugin.
  537. ping_interval
  538. -------------
  539. * Default: ``180``
  540. Make ping to server in order to keep connection with server killing sessions after idle timeout.
  541. The ping are sent only if no messages are sent in the last ``ping_interval`` seconds
  542. You need to set the value to any positive value to enable this functionality.
  543. If you set this value to ``0`` or any negative value, il will disable this functionality.
  544. .. _`play-sounds`:
  545. play_sounds
  546. -----------
  547. * Default: ``false``
  548. Plays a notification sound when you receive a personal message or when your
  549. nickname is mentioned in a chat room.
  550. Inside the ``./sounds`` directory of the Converse.js repo you'll see MP3 and Ogg
  551. formatted sound files. We need both, because neither format is supported by all browsers.
  552. You can set the URL where the sound files are hosted with the `sounds_path`_
  553. option.
  554. Requires the `src/converse-notification.js` plugin.
  555. .. _`prebind_url`:
  556. prebind_url
  557. -----------
  558. * Default: ``null``
  559. * Type: URL
  560. See also: :ref:`session-support`
  561. This setting should be used in conjunction with ``authentication`` set to `prebind` and :ref:`keepalive` set to ``true``.
  562. It allows you to specify a URL which converse.js will call when it needs to get
  563. the RID and SID (Request ID and Session ID) tokens of a BOSH connection, which
  564. converse.js will then attach to.
  565. The server behind ``prebind_url`` should return a JSON encoded object with the
  566. three tokens::
  567. {
  568. "jid": "me@example.com/resource",
  569. "sid": "346234623462",
  570. "rid": "876987608760"
  571. }
  572. providers_link
  573. --------------
  574. * Default: ``https://xmpp.net/directory.php``
  575. The hyperlink on the registration form which points to a directory of public
  576. XMPP servers.
  577. roster_groups
  578. -------------
  579. * Default: ``false``
  580. If set to ``true``, converse.js will show any roster groups you might have
  581. configured.
  582. .. note::
  583. It's currently not possible to use converse.js to assign contacts to groups.
  584. Converse.js can only show users and groups that were previously configured
  585. elsewhere.
  586. show_chatstate_notifications
  587. ----------------------------
  588. * Default: ``false``
  589. Specifies whether chat state (online, dnd, away) HTML5 desktop notifications should be shown.
  590. show_controlbox_by_default
  591. --------------------------
  592. * Default: ``false``
  593. The "controlbox" refers to the special chatbox containing your contacts roster,
  594. status widget, chatrooms and other controls.
  595. By default this box is hidden and can be toggled by clicking on any element in
  596. the page with class *toggle-controlbox*.
  597. If this options is set to true, the controlbox will by default be shown upon
  598. page load.
  599. However, be aware that even if this value is set to ``false``, if the
  600. controlbox is open, and the page is reloaded, then it will stay open on the new
  601. page as well.
  602. .. _`show-desktop-notifications`:
  603. show_desktop_notifications
  604. --------------------------
  605. * Default: ``true``
  606. Should HTML5 desktop notifications be shown?
  607. Notification will be shown in the following cases:
  608. * the browser is not visible nor focused and a private message is received.
  609. * the browser is not visible nor focused and a groupchat message is received which mentions you.
  610. * `auto_subscribe` is set to `false` and a new contact request is received.
  611. Requires the `src/converse-notification.js` plugin.
  612. show_only_online_users
  613. ----------------------
  614. * Default: ``false``
  615. If set to ``true``, only online users will be shown in the contacts roster.
  616. Users with any other status (e.g. away, busy etc.) will not be shown.
  617. sounds_path
  618. -----------
  619. * Default: ``/sounds/``
  620. This option only makes sense in conjunction with the `play_sounds`_ option and
  621. specifies the URL of the sound files to be played (exluding the file names
  622. themselves).
  623. In order to support all browsers we need both an MP3 and an Ogg file. Make sure
  624. to name your files ``msg_received.ogg`` and ``msg_received.mp3``.
  625. storage
  626. -------
  627. * Default: ``session``
  628. Valid options: ``session``, ``local``.
  629. This option determines the type of `browser storage <https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage>`_
  630. (``localStorage`` or ``sessionStorage``) used by converse.js to cache user data.
  631. Originally converse.js used only `localStorage`, however `sessionStorage` is from a
  632. privacy perspective a better choice.
  633. The main difference between the two is that `sessionStorage` only persists while
  634. the current tab or window containing a converse.js instance is open. As soon as
  635. it's closed, the data is cleared.
  636. Data in `localStorage` on the other hand is kept indefinitely.
  637. The data that is cached includes which chats you had open, what features the
  638. XMPP server supports and what your online status was.
  639. Since version 1.0.7, the store for messages is now configurable separately with
  640. the `message_storage`_ option, to allow you to cache messages for longer in the
  641. browser (with `localStorage`) while still using `sessionStorage` for other
  642. data.
  643. .. note::
  644. Between versions 0.8.0 and 1.0.7, setting the value of this option to "local"
  645. is not recommended. The statuses (online, away, busy etc.) of your roster
  646. contacts are cached in the browser storage. If you use local storage, these
  647. values are stored for multiple sessions, and they will likely become out of
  648. sync with your contacts' actual statuses. The session storage doesn't have
  649. this problem, because roster contact statuses will not become out of sync in
  650. a single session, only across more than one session.
  651. Since version 1.0.7, the "storage" option doesn't apply anymore to how roster
  652. contacts and their statuses are stored (they're now always stored in session
  653. storage), to address the above issue.
  654. sticky_controlbox
  655. -----------------
  656. * Default: ``false``
  657. If set to ``true``, the control box (which includes the login, registration,
  658. contacts and rooms tabs) will not be closeable. It won't have a close button at
  659. all.
  660. The idea behind this setting is to provide a better experience on mobile
  661. devices when the intent is to use converse.js as a web app. In this case
  662. it doesn't make sense to close the control box, as there's often then nothing
  663. "behind" it that's relevant to the user.
  664. strict_plugin_dependencies
  665. --------------------------
  666. * Default: ``false``
  667. When set to ``true`` and a plugin tries to override an object which doesn't
  668. exist (for example because the plugin which provides that object is not
  669. loaded), then an error will be raised.
  670. Otherwise a message will simply be logged and the override instruction ignored.
  671. This allows plugins to have "soft" dependencies which aren't declared as
  672. as dependencies.
  673. synchronize_availability
  674. ------------------------
  675. * Default: ``true``
  676. Valid options: ``true``, ``false``, ``a resource name``.
  677. This option lets you synchronize your chat status (`online`, `busy`, `away`) with other chat clients. In other words,
  678. if you change your status to `busy` in a different chat client, your status will change to `busy` in converse.js as well.
  679. If set to ``true``, converse.js will synchronize with all other clients you are logged in with.
  680. If set to ``false``, this feature is disabled.
  681. If set to ``a resource name``, converse.js will synchronize only with a client that has that particular resource assigned to it.
  682. use_otr_by_default
  683. ------------------
  684. * Default: ``false``
  685. If set to ``true``, Converse.js will automatically try to initiate an OTR (off-the-record)
  686. encrypted chat session every time you open a chat box.
  687. use_vcards
  688. ----------
  689. * Default: ``true``
  690. Determines whether the XMPP server will be queried for roster contacts' VCards
  691. or not. VCards contain extra personal information such as your fullname and
  692. avatar image.
  693. visible_toolbar_buttons
  694. -----------------------
  695. * Default:
  696. .. code-block:: javascript
  697. {
  698. call: false,
  699. clear: true,
  700. emoticons: true,
  701. toggle_occupants: true
  702. }
  703. Allows you to show or hide buttons on the chat boxes' toolbars.
  704. * *call*:
  705. Provides a button with a picture of a telephone on it.
  706. When the call button is pressed, it will emit an event that can be used by a third-party library to initiate a call.
  707. .. code-block:: javascript
  708. converse.listen.on('callButtonClicked', function(data) {
  709. console.log('Strophe connection is', data.connection);
  710. console.log('Bare buddy JID is', data.model.get('jid'));
  711. // ... Third-party library code ...
  712. });
  713. * *clear*:
  714. Provides a button for clearing messages from a chat box.
  715. * *emoticons*:
  716. Enables rendering of emoticons and provides a toolbar button for choosing them.
  717. * toggle_occupants:
  718. Shows a button for toggling (i.e. showing/hiding) the list of occupants in a chat room.
  719. .. _`websocket-url`:
  720. websocket_url
  721. -------------
  722. * Default: ``undefined``
  723. This option is used to specify a
  724. `websocket <https://developer.mozilla.org/en/docs/WebSockets>`_ URI to which
  725. converse.js can connect to.
  726. Websockets provide a more modern and effective two-way communication protocol
  727. between the browser and a server, effectively emulating TCP at the application
  728. layer and therefore overcoming many of the problems with existing long-polling
  729. techniques for bidirectional HTTP (such as `BOSH <https://en.wikipedia.org/wiki/BOSH>`_).
  730. Please refer to your XMPP server's documentation on how to enable websocket
  731. support.
  732. .. note::
  733. Please note that not older browsers do not support websockets. For older
  734. browsers you'll want to specify a BOSH URL. See the :ref:`bosh-service-url`
  735. configuration setting).
  736. .. note::
  737. Converse.js does not yet support "keepalive" with websockets.
  738. blacklisted_plugins
  739. -------------------
  740. * Default: ``[]``
  741. A list of plugin names that are blacklisted and will therefore not be
  742. initialized once ``converse.initialize`` is called, even if the same plugin is
  743. whitelisted.
  744. From Converse.js 3.0 onwards most of the API is available only to plugins and
  745. all plugins need to be whitelisted first.
  746. The usecase for blacklisting is generally to disable removed core plugins
  747. (which are automatically whitelisted) to prevent other (potentially malicious)
  748. plugins from registering themselves under those names.
  749. The core, and by default whitelisted, plugins are::
  750. converse-bookmarks
  751. converse-chatview
  752. converse-controlbox
  753. converse-core
  754. converse-dragresize
  755. converse-headline
  756. converse-mam
  757. converse-minimize
  758. converse-muc
  759. converse-notification
  760. converse-otr
  761. converse-ping
  762. converse-register
  763. converse-rosterview
  764. converse-vcard
  765. An example from `the embedded room demo <https://conversejs.org/demo/embedded.html>`_
  766. .. code-block:: javascript
  767. require(['converse-core', 'converse-muc-embedded'], function (converse) {
  768. converse.initialize({
  769. // other settings removed for brevity
  770. blacklisted_plugins: [
  771. 'converse-controlbox',
  772. 'converse-dragresize',
  773. 'converse-minimize',
  774. 'converse-vcard'
  775. ],
  776. });
  777. });
  778. whitelisted_plugins
  779. -------------------
  780. * Default: ``[]``
  781. A list of plugin names that are whitelisted and will therefore be
  782. initialized once ``converse.initialize`` is called.
  783. From Converse.js 3.0 onwards most of the API is available only to plugins and
  784. all plugins need to be whitelisted first.
  785. This is done to prevent malicious scripts from using the API to trick users or
  786. to read their conversations.
  787. By default all the core plugins are already whitelisted.
  788. These are::
  789. converse-bookmarks
  790. converse-chatview
  791. converse-controlbox
  792. converse-core
  793. converse-dragresize
  794. converse-headline
  795. converse-mam
  796. converse-minimize
  797. converse-muc
  798. converse-notification
  799. converse-otr
  800. converse-ping
  801. converse-register
  802. converse-rosterview
  803. converse-vcard
  804. If you are using a custom build which excludes some core plugins, then you
  805. should blacklist them so that malicious scripts can't register their own
  806. plugins under those names. See `blacklisted_plugins`_ for more info.
  807. An example from `the embedded room demo <https://conversejs.org/demo/embedded.html>`_
  808. .. code-block:: javascript
  809. require(['converse-core', 'converse-muc-embedded'], function (converse) {
  810. converse.initialize({
  811. // other settings removed for brevity
  812. whitelisted_plugins: ['converse-muc-embedded']
  813. });
  814. });
  815. xhr_custom_status
  816. -----------------
  817. * Default: ``false``
  818. .. note::
  819. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  820. This option will let converse.js make an AJAX POST with your changed custom chat status to a
  821. remote server.
  822. xhr_custom_status_url
  823. ---------------------
  824. .. note::
  825. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  826. * Default: Empty string
  827. Used only in conjunction with ``xhr_custom_status``.
  828. This is the URL to which the AJAX POST request to set the user's custom status
  829. message will be made.
  830. The message itself is sent in the request under the key ``msg``.
  831. xhr_user_search
  832. ---------------
  833. * Default: ``false``
  834. .. note::
  835. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  836. There are two ways to add users.
  837. * The user inputs a valid JID (Jabber ID), and the user is added as a pending contact.
  838. * 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.
  839. This setting enables the second mechanism, otherwise by default the first will be used.
  840. *What is expected from the remote server?*
  841. A default JSON encoded list of objects must be returned. Each object
  842. corresponds to a matched user and needs the keys ``id`` and ``fullname``.
  843. .. note::
  844. Make sure your server script sets the header `Content-Type: application/json`.
  845. xhr_user_search_url
  846. -------------------
  847. .. note::
  848. XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).
  849. * Default: Empty string
  850. Used only in conjunction with ``xhr_user_search``.
  851. This is the URL to which an XHR GET request will be made to fetch user data from your remote server.
  852. The query string will be included in the request with ``q`` as its key.
  853. The data returned must be a JSON encoded list of user JIDs.