浏览代码

Mention that `credentials_url` can/should be used with `auto_login`

JC Brand 8 年之前
父节点
当前提交
ed9ba78863
共有 2 个文件被更改,包括 13 次插入3 次删除
  1. 10 1
      docs/source/configuration.rst
  2. 3 2
      docs/source/events.rst

+ 10 - 1
docs/source/configuration.rst

@@ -250,7 +250,12 @@ soon as the page loads.
 It should be used either with ``authentication`` set to ``anonymous`` or to ``login``.
 
 If ``authentication`` is set to ``login``, then you will also need to provide a
-valid ``jid`` and ``password`` values.
+valid ``jid`` and ``password`` values, either manually by passing them in, or
+by the `credentials_url`_ setting. Setting a ``credentials_url`` is preferable
+to manually passing in ``jid`` and ``password`` values, because it allows
+better reconnection with ``auto_reconnect``. When the connection drops,
+converse.js will automatically fetch new login credentials from the
+``credentials_url`` and reconnect.
 
 If ``authentication`` is set to ``anonymous``, then you will also need to provide the
 server's domain via the `jid`_ setting.
@@ -437,6 +442,10 @@ It allows you to specify a URL which converse.js will call when it needs to get
 the username and password (or authentication token) which converse.js will use
 to automatically log the user in.
 
+If ``auto_reconnect`` is also set to true, then converse.js will automatically
+fetch new credentials from the ``credentials_url`` whenever the connection or
+session drops, and then attempt to reconnect and establish a new session.
+
 The server behind ``credentials_url`` should return a JSON encoded object::
 
     {

+ 3 - 2
docs/source/events.rst

@@ -151,7 +151,8 @@ Once a message has been added to a chat box. The passed in data object contains
 a `chatbox` attribute, referring to the chat box receiving the message, as well
 as a `message` attribute which refers to the Message model.
 
-.. code-block:: javascript
+.. code-block:: javascript 
+
     _converse.on('messageAdded', function (data) {
         // The message is at `data.message`
         // The original chat box is at `data.chatbox`.
@@ -289,4 +290,4 @@ windowStateChanged
 
 When window state has changed. Used to determine when a user left the page and when came back.
 
-``_converse.on('windowStateChanged', function (data) { ... });``
+``_converse.on('windowStateChanged', function (data) { ... });``