Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Romain Courteaud
erp5_rtl_support
Commits
450885f3
Commit
450885f3
authored
Mar 16, 2016
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_jabber_client: connection immediately disconnect on browser window close
it save from message loss.
parent
8f702e79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
13 deletions
+27
-13
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberconnection_js.js
...Item/web_page_module/jabber_gadget_jabberconnection_js.js
+27
-13
No files found.
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberconnection_js.js
View file @
450885f3
...
...
@@ -50,6 +50,18 @@
}
function
disconnectOnbeforeunload
(
connection
)
{
return
function
(
event
)
{
/* XXX it can be interfere with changed warning
if (changed && $('button.save')) {
return unsaved_warn_message;
}*/
connection
.
sync
=
true
;
connection
.
disconnect
();
connection
.
flush
();
};
}
function
deferOnMessageStanza
(
message
)
{
var
gadget
=
this
;
enqueueDefer
(
gadget
,
function
()
{
...
...
@@ -148,27 +160,29 @@
// Try to auto connection
if
(
gadget
.
props
.
server
!==
undefined
)
{
gadget
.
props
.
connection
=
new
Strophe
.
Connection
(
gadget
.
props
.
server
);
// gadget.props.connection.rawInput = function (data) {
// console.log("RECEIVING SOMETHING");
// console.log(data);
// };
// gadget.props.connection.rawOutput = function (data) {
// console.log("SENDING SOMETHING");
// console.log(data);
// };
gadget
.
props
.
connection
.
connect
(
var
connection
=
gadget
.
props
.
connection
;
// connection.rawInput = function (data) {
// console.log("RECEIVING SOMETHING");
// console.log(data);
// };
// connection.rawOutput = function (data) {
// console.log("SENDING SOMETHING");
// console.log(data);
// };
connection
.
connect
(
gadget
.
props
.
jid
,
gadget
.
props
.
passwd
,
handleConnectionCallback
);
gadget
.
props
.
connection
.
addHandler
(
window
.
onbeforeunload
=
disconnectOnbeforeunload
(
connection
);
connection
.
addHandler
(
deferOnPresenceStanza
.
bind
(
gadget
),
null
,
"
presence
"
);
gadget
.
props
.
connection
.
addHandler
(
connection
.
addHandler
(
deferOnMessageStanza
.
bind
(
gadget
),
null
,
"
message
"
,
...
...
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