Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
778b4ff1
Commit
778b4ff1
authored
Jul 26, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix. Fix check for debounced reconnection
parent
5a48f3da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
src/headless/converse-core.js
src/headless/converse-core.js
+9
-7
No files found.
src/headless/converse-core.js
View file @
778b4ff1
...
@@ -496,7 +496,7 @@ function reconnect () {
...
@@ -496,7 +496,7 @@ function reconnect () {
_converse
.
connection
.
reconnecting
=
true
;
_converse
.
connection
.
reconnecting
=
true
;
tearDown
();
tearDown
();
_converse
.
api
.
user
.
login
(
null
,
null
,
true
);
return
_converse
.
api
.
user
.
login
(
null
,
null
,
true
);
}
}
const
debouncedReconnect
=
_
.
debounce
(
reconnect
,
2000
);
const
debouncedReconnect
=
_
.
debounce
(
reconnect
,
2000
);
...
@@ -620,6 +620,7 @@ async function onConnected (reconnecting) {
...
@@ -620,6 +620,7 @@ async function onConnected (reconnecting) {
/* Called as soon as a new connection has been established, either
/* Called as soon as a new connection has been established, either
* by logging in or by attaching to an existing BOSH session.
* by logging in or by attaching to an existing BOSH session.
*/
*/
delete
_converse
.
connection
.
reconnecting
;
_converse
.
connection
.
flush
();
// Solves problem of returned PubSub BOSH response not received by browser
_converse
.
connection
.
flush
();
// Solves problem of returned PubSub BOSH response not received by browser
await
setUserJID
(
_converse
.
connection
.
jid
);
await
setUserJID
(
_converse
.
connection
.
jid
);
/**
/**
...
@@ -1371,6 +1372,11 @@ _converse.api = {
...
@@ -1371,6 +1372,11 @@ _converse.api = {
*/
*/
async
reconnect
()
{
async
reconnect
()
{
const
conn_status
=
_converse
.
connfeedback
.
get
(
'
connection_status
'
);
const
conn_status
=
_converse
.
connfeedback
.
get
(
'
connection_status
'
);
if
(
_converse
.
authentication
===
_converse
.
ANONYMOUS
)
{
tearDown
();
clearSession
();
}
if
(
conn_status
===
Strophe
.
Status
.
CONNFAIL
)
{
if
(
conn_status
===
Strophe
.
Status
.
CONNFAIL
)
{
// When reconnecting with a new transport, we call setUserJID
// When reconnecting with a new transport, we call setUserJID
// so that a new resource is generated, to avoid multiple
// so that a new resource is generated, to avoid multiple
...
@@ -1388,8 +1394,6 @@ _converse.api = {
...
@@ -1388,8 +1394,6 @@ _converse.api = {
// When reconnecting anonymously, we need to connect with only
// When reconnecting anonymously, we need to connect with only
// the domain, not the full JID that we had in our previous
// the domain, not the full JID that we had in our previous
// (now failed) session.
// (now failed) session.
tearDown
();
clearSession
();
await
setUserJID
(
_converse
.
settings
.
jid
);
await
setUserJID
(
_converse
.
settings
.
jid
);
}
else
{
}
else
{
await
setUserJID
(
_converse
.
bare_jid
);
await
setUserJID
(
_converse
.
bare_jid
);
...
@@ -1403,14 +1407,12 @@ _converse.api = {
...
@@ -1403,14 +1407,12 @@ _converse.api = {
// When reconnecting anonymously, we need to connect with only
// When reconnecting anonymously, we need to connect with only
// the domain, not the full JID that we had in our previous
// the domain, not the full JID that we had in our previous
// (now failed) session.
// (now failed) session.
tearDown
();
clearSession
();
await
setUserJID
(
_converse
.
settings
.
jid
);
await
setUserJID
(
_converse
.
settings
.
jid
);
}
}
if
(
[
Strophe
.
Status
.
RECONNECTING
,
Strophe
.
Status
.
CONNFAIL
].
includes
(
conn_status
)
)
{
if
(
_converse
.
connection
.
reconnecting
)
{
debouncedReconnect
();
debouncedReconnect
();
}
else
{
}
else
{
reconnect
();
re
turn
re
connect
();
}
}
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment