Skip to content

Commit 61382da

Browse files
committed
fix lp connection on network error
1 parent 8ab6b7f commit 61382da

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/connection.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export default class Connection {
272272
let poller = new XHRProvider();
273273
let promiseCompleted = false;
274274

275-
poller.onreadystatechange = (evt) => {
275+
poller.onreadystatechange = evt => {
276276
if (poller.readyState == XDR_DONE) {
277277
if (poller.status == 201) { // 201 == HTTP.Created, get SID
278278
let pkt = JSON.parse(poller.responseText, jsonParseHelper);
@@ -291,7 +291,7 @@ export default class Connection {
291291
if (this.autoreconnect) {
292292
this.#boffStop();
293293
}
294-
} else if (poller.status < 400) { // 400 = HTTP.BadRequest
294+
} else if (poller.status > 0 && poller.status < 400) { // 0 = network error; 400 = HTTP.BadRequest
295295
if (this.onMessage) {
296296
this.onMessage(poller.responseText);
297297
}

umd/tinode.dev.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

umd/tinode.prod.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)