mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-12-24 08:28:56 -05:00
Try to kill hanging sessions
This commit is contained in:
parent
e435c178c8
commit
fb86237955
@ -31,6 +31,10 @@ module.exports = {
|
||||
$(window).focus(function () {
|
||||
me.hasFocus = true;
|
||||
});
|
||||
window.onbeforeunload = function () {
|
||||
client.disconnect();
|
||||
return "End active session?";
|
||||
};
|
||||
|
||||
config = JSON.parse(config);
|
||||
|
||||
|
@ -256,6 +256,7 @@ function Client(opts) {
|
||||
self.negotiatedFeatures.sasl = false;
|
||||
self.negotiatedFeatures.streamManagement = false;
|
||||
self.negotiatedFeatures.bind = false;
|
||||
self.negotiatedFeatures.session = false;
|
||||
self.releaseGroup('connection');
|
||||
});
|
||||
|
||||
@ -4991,6 +4992,7 @@ WSConnection.prototype.connect = function (opts) {
|
||||
};
|
||||
|
||||
self.conn.onopen = function () {
|
||||
self.sm.started = false;
|
||||
self.emit('connected', self);
|
||||
};
|
||||
|
||||
@ -5010,6 +5012,7 @@ WSConnection.prototype.disconnect = function () {
|
||||
this.conn.close();
|
||||
this.stream = undefined;
|
||||
this.conn = undefined;
|
||||
this.sm.failed();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*global $, app, me*/
|
||||
/*global $, app, me, client*/
|
||||
"use strict";
|
||||
|
||||
var HumanView = require('human-view');
|
||||
@ -9,7 +9,8 @@ var ContactListItem = require('../views/contactListItem');
|
||||
module.exports = HumanView.extend({
|
||||
template: templates.body,
|
||||
events: {
|
||||
'click a[href]': 'handleLinkClick'
|
||||
'click a[href]': 'handleLinkClick',
|
||||
'click .reconnect': 'handleReconnect'
|
||||
},
|
||||
classBindings: {
|
||||
connected: '#connectionOverlay'
|
||||
@ -21,6 +22,9 @@ module.exports = HumanView.extend({
|
||||
this.renderCollection(me.contacts, ContactListItem, this.$('#roster nav'));
|
||||
return this;
|
||||
},
|
||||
handleReconnect: function (e) {
|
||||
client.connect();
|
||||
},
|
||||
handleLinkClick: function (e) {
|
||||
var t = $(e.target);
|
||||
var aEl = t.is('a') ? t[0] : t.closest('a')[0];
|
||||
|
Loading…
Reference in New Issue
Block a user