Skip to content

Commit

Permalink
🐛 Fix notifications are resent after each reconnection
Browse files Browse the repository at this point in the history
* [FIX] All notifications are resent after each reconnection
- Update the persistentIds list with the last persistentId received in each new notification. Updating so, prevents from notification duplications in case the connection is down and then up again (in this particular case the persistentIds are all re sent by the server and were tested against an outdated persistentIds list).
  • Loading branch information
PedroKantar authored and MatthieuLemoine committed Nov 15, 2017
1 parent 333626d commit 42b0f60
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client/socket/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ function onMessageReceived(buffer, NotificationSchema, keys, persistentIds) {
}
const message = decrypt(object, keys);
if (message) {
// Maintain persistentIds updated with the very last received value
persistentIds.push(object.persistentId);
// Send notification
emitter.emit(ON_NOTIFICATION_RECEIVED, {
notification : message,
Expand Down

0 comments on commit 42b0f60

Please sign in to comment.