Procházet zdrojové kódy

Further document the `auto_reconnect` option

and drop the reconnection timeout to 3 seconds (from 5).
JC Brand před 9 roky
rodič
revize
1ee7d06a08
2 změnil soubory, kde provedl 14 přidání a 2 odebrání
  1. 12 0
      docs/source/configuration.rst
  2. 2 2
      src/converse-core.js

+ 12 - 0
docs/source/configuration.rst

@@ -256,6 +256,18 @@ auto_reconnect
 Automatically reconnect to the XMPP server if the connection drops
 unexpectedly.
 
+This option works best when you have `authentication` set to `prebind` and have
+also specified a `prebind_url` URL, from where converse.js can fetch the BOSH
+tokens. In this case, converse.js will automaticallly reconnect when the
+connection drops but also reestablish earlier lost connections (due to
+network outages, closing your laptop etc.).
+
+When `authentication` is set to `login`, then this option will only work when
+the page hasn't been reloaded yet, because then the user's password has been
+wiped from memory. This configuration can however still be useful when using
+converse.js in desktop apps, for example those based on `CEF <https://bitbucket.org/chromiumembedded/cef>`_
+or `electron <http://electron.atom.io/>`_.
+
 auto_subscribe
 --------------
 

+ 2 - 2
src/converse-core.js

@@ -423,8 +423,8 @@
                         (converse.disconnection_cause === Strophe.Status.DISCONNECTING ||
                         converse.disconnection_cause === Strophe.Status.DISCONNECTED) &&
                             converse.auto_reconnect) {
-                    window.setTimeout(_.partial(converse.reconnect, condition), 5000);
-                    converse.log('RECONNECTING IN 5 SECONDS');
+                    window.setTimeout(_.partial(converse.reconnect, condition), 3000);
+                    converse.log('RECONNECTING IN 3 SECONDS');
                     return 'reconnecting';
                 }
             }