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
51f2ab91
Commit
51f2ab91
authored
Jun 04, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1196. Use alternative connection method upon connfail
parent
297f3d9e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
3 deletions
+29
-3
CHANGES.md
CHANGES.md
+1
-0
src/headless/converse-core.js
src/headless/converse-core.js
+27
-2
src/headless/converse-muc.js
src/headless/converse-muc.js
+1
-1
No files found.
CHANGES.md
View file @
51f2ab91
...
...
@@ -26,6 +26,7 @@
-
New event:
[
chatBoxBlurred
](
https://conversejs.org/docs/html/api/-_converse.html#event:chatBoxBlurred
)
-
New event:
[
chatReconnected
](
https://conversejs.org/docs/html/api/-_converse.html#event:chatReconnected
)
-
#316: Add support for XEP-0198 Stream Management
-
#1196: Use alternative connection method upon connfail
-
#1296:
`embedded`
view mode shows
`chatbox-navback`
arrow in header
-
#1330: Missing room name in MUC invitation popup
-
#1445: Participants list uses big font in embedded mode
...
...
src/headless/converse-core.js
View file @
51f2ab91
...
...
@@ -1460,16 +1460,41 @@ _converse.api = {
* Can be called once the XMPP connection has dropped and we want
* to attempt reconnection.
* Only needs to be called once, if reconnect fails Converse will
* attempt to reconnect every two seconds.
* attempt to reconnect every two seconds, alternating between BOSH and
* Websocket if URLs for both were provided.
* @method reconnect
* @memberOf _converse.api.connection
*/
reconnect
()
{
if
(
_converse
.
connfeedback
.
get
(
'
connection_status
'
)
===
Strophe
.
Status
.
RECONNECTING
)
{
const
conn_status
=
_converse
.
connfeedback
.
get
(
'
connection_status
'
);
if
(
conn_status
===
Strophe
.
Status
.
CONNFAIL
)
{
if
(
_converse
.
api
.
connection
.
isType
(
'
websocket
'
)
&&
_converse
.
bosh_service_url
)
{
_converse
.
connection
.
_proto
=
new
Strophe
.
Bosh
(
_converse
.
connection
);
_converse
.
connection
.
service
=
_converse
.
bosh_service_url
;
}
else
if
(
_converse
.
api
.
connection
.
isType
(
'
bosh
'
)
&&
_converse
.
websocket_url
)
{
_converse
.
connection
.
_proto
=
new
Strophe
.
Websocket
(
_converse
.
connection
);
_converse
.
connection
.
service
=
_converse
.
websocket_url
;
}
}
if
([
Strophe
.
Status
.
RECONNECTING
,
Strophe
.
Status
.
CONNFAIL
].
includes
(
conn_status
))
{
debouncedReconnect
();
}
else
{
reconnect
();
}
},
/**
* Utility method to determine the type of connection we have
* @method isType
* @memberOf _converse.api.connection
* @returns {boolean}
*/
isType
(
type
)
{
if
(
type
.
toLowerCase
()
===
'
websocket
'
)
{
return
_converse
.
connection
.
_proto
instanceof
Strophe
.
Websocket
;
}
else
if
(
type
.
toLowerCase
()
===
'
bosh
'
)
{
return
_converse
.
connection
.
_proto
instanceof
Strophe
.
Bosh
;
}
}
},
...
...
src/headless/converse-muc.js
View file @
51f2ab91
...
...
@@ -1724,7 +1724,7 @@ converse.plugins.add('converse-muc', {
_converse
.
api
.
listen
.
on
(
'
statusInitialized
'
,
()
=>
{
window
.
addEventListener
(
_converse
.
unloadevent
,
()
=>
{
const
using_websocket
=
_converse
.
connection
.
_proto
instanceof
Strophe
.
Websocket
;
const
using_websocket
=
_converse
.
api
.
connection
.
isType
(
'
websocket
'
)
;
if
(
using_websocket
&&
!
_converse
.
enable_smacks
)
{
// For non-SMACKS websocket connections, we disconnect all
// chatrooms when the page unloads.
...
...
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