JC Brand 5 years ago
parent
commit
7fc3151e56
3 changed files with 4 additions and 2 deletions
  1. 1 1
      src/headless/converse-bosh.js
  2. 2 1
      src/headless/converse-core.js
  3. 1 0
      webpack.html

+ 1 - 1
src/headless/converse-bosh.js

@@ -90,7 +90,7 @@ converse.plugins.add('converse-bosh', {
 
 
         _converse.restoreBOSHSession = async function () {
         _converse.restoreBOSHSession = async function () {
             const jid = (await initBOSHSession()).get('jid');
             const jid = (await initBOSHSession()).get('jid');
-            if (jid) {
+            if (jid && (_converse.connection._proto instanceof Strophe.Bosh)) {
                 try {
                 try {
                     _converse.connection.restore(jid, _converse.onConnectStatusChanged);
                     _converse.connection.restore(jid, _converse.onConnectStatusChanged);
                     return true;
                     return true;

+ 2 - 1
src/headless/converse-core.js

@@ -1397,7 +1397,8 @@ _converse.api = {
             }
             }
 
 
             // See whether there is a BOSH session to re-attach to
             // See whether there is a BOSH session to re-attach to
-            if (_.invoke(_converse.pluggable.plugins['converse-bosh'], 'enabled')) {
+            const bosh_plugin = _converse.pluggable.plugins['converse-bosh'];
+            if (bosh_plugin && bosh_plugin.enabled()) {
                 if (await _converse.restoreBOSHSession()) {
                 if (await _converse.restoreBOSHSession()) {
                     return;
                     return;
                 } else if (_converse.authentication === _converse.PREBIND && (!automatic || _converse.auto_login)) {
                 } else if (_converse.authentication === _converse.PREBIND && (!automatic || _converse.auto_login)) {

+ 1 - 0
webpack.html

@@ -27,6 +27,7 @@
         muc_respect_autojoin: true,
         muc_respect_autojoin: true,
         view_mode: 'fullscreen',
         view_mode: 'fullscreen',
         websocket_url: 'ws://chat.example.org:5380/xmpp-websocket',
         websocket_url: 'ws://chat.example.org:5380/xmpp-websocket',
+        // bosh_service_url: 'http://chat.example.org:5280/http-bind',
         muc_show_logs_before_join: true,
         muc_show_logs_before_join: true,
         whitelisted_plugins: ['converse-debug'],
         whitelisted_plugins: ['converse-debug'],
     });
     });