Set default BOSH wait time to 59

to avoid timing conflicts with the webserver
This commit is contained in:
JC Brand 2018-07-28 17:13:13 +02:00
parent b323794fe4
commit 964b10dc33
2 changed files with 14 additions and 3 deletions

View File

@ -202,7 +202,10 @@ Apache
Line Number 6, Column 3: bosh-anon:6:3
Also ERROR: request id 12.2 error 504 happened
Then it might be because your webserver and BOSH proxy have the same timeout
Then your BOSH proxy is returning an HTML error page (for a 504 error in
the above example).
This might be because your webserver and BOSH proxy have the same timeout
for BOSH requests. Because the webserver receives the request slightly earlier,
it gives up a few microseconds before the XMPP servers empty result and thus returns a
504 error page containing HTML to browser, which then gets parsed as if its
@ -211,6 +214,9 @@ Apache
To fix this, make sure that the webserver's timeout is slightly higher.
In Nginx you can do this by adding ``proxy_read_timeout 61;``;
From Converse 4.0.0 onwards the default ``wait`` time is set to 59 seconds, to avoid
this problem.
.. _`session-support`:

View File

@ -98,6 +98,11 @@
'converse-vcard'
];
// Setting wait to 59 instead of 60 to avoid timing conflicts with the
// webserver, which is often also set to 60 and might therefore sometimes
// return a 504 error page instead of passing through to the BOSH proxy.
const BOSH_WAIT = 59;
// Make converse pluggable
pluggable.enable(_converse, '_converse', 'pluggable');
@ -1025,7 +1030,7 @@
if (!this.connection.reconnecting) {
this.connection.reset();
}
this.connection.connect(this.jid.toLowerCase(), null, this.onConnectStatusChanged);
this.connection.connect(this.jid.toLowerCase(), null, this.onConnectStatusChanged, BOSH_WAIT);
} else if (this.authentication === _converse.LOGIN) {
const password = _.isNil(credentials) ? (_converse.connection.pass || this.password) : credentials.password;
if (!password) {
@ -1046,7 +1051,7 @@
if (!this.connection.reconnecting) {
this.connection.reset();
}
this.connection.connect(this.jid, password, this.onConnectStatusChanged);
this.connection.connect(this.jid, password, this.onConnectStatusChanged, BOSH_WAIT);
}
};