Fix duplicate notifications n reconnect
This commit is contained in:
parent
64304c57d3
commit
7bc0c7ce95
@ -245,8 +245,11 @@ proxy.mailboxes = {
|
|||||||
});
|
});
|
||||||
box.queue = [];
|
box.queue = [];
|
||||||
};
|
};
|
||||||
|
var lastReceivedHash; // Don't send a duplicate of the last known hash on reconnect
|
||||||
box.onMessage = cfg.onMessage = function (msg, user, vKey, isCp, hash, author) {
|
box.onMessage = cfg.onMessage = function (msg, user, vKey, isCp, hash, author) {
|
||||||
if (hash === m.lastKnownHash) { return; }
|
if (hash === m.lastKnownHash) { return; }
|
||||||
|
if (hash === lastReceivedHash) { return; }
|
||||||
|
lastReceivedHash = hash;
|
||||||
try {
|
try {
|
||||||
msg = JSON.parse(msg);
|
msg = JSON.parse(msg);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -364,6 +367,7 @@ proxy.mailboxes = {
|
|||||||
txid: txid,
|
txid: txid,
|
||||||
complete: true
|
complete: true
|
||||||
}, [req.cId]);
|
}, [req.cId]);
|
||||||
|
delete ctx.req[txid];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user