Store session per full JID
Otherwise we run into a bug where two tabs with Converse.js share the same XEP-0198 SM-ID, causing both to go into a reconnection-loop as the XMPP server switches XEP-0198 sessions between them. This bug is due to a distinction in how sessionStorage behaves when you open the existing site in a new tab (e.g. middle-click or `target="_blank"), as opposed to creating a new tab and then opening the site in that tab. In the latter case, the newly created sessionStorage object is empty. In the former, the contents of sessionStorage of the current page is copied over to the new page!
This commit is contained in:
parent
54804b5b89
commit
607d798665
@ -506,8 +506,10 @@ _converse.initConnection = function () {
|
||||
|
||||
|
||||
async function initUserSession (jid) {
|
||||
const bare_jid = Strophe.getBareJidFromJid(jid);
|
||||
const id = `converse.session-${bare_jid}`;
|
||||
// XXX: Important to use full JID, otherwise we run into a bug where two
|
||||
// tabs with share the same XEP-0198 SM-ID, causing them to go into a
|
||||
// reconnection-loop.
|
||||
const id = `converse.session-${jid}`;
|
||||
if (!_converse.session || _converse.session.get('id') !== id) {
|
||||
_converse.session = new Backbone.Model({id});
|
||||
_converse.session.browserStorage = new BrowserStorage.session(id);
|
||||
|
Loading…
Reference in New Issue
Block a user