Message Listeners Duplicate Messages IOS/Android

Hi, we have found a strange issue related to the message listeners.

When 1st launching and running the app on IOS or Android, when receiving a new incoming message, everything works fine.

If you lock the device (Android or IOS) with the app still open, then unlock the device or place the app in the background by viewing another application and view the app again. When another message comes in, it is duplicated. You can then repeat the same steps above and when the user receives message it is tripled and so forth.

Our listeners all have unique ID’s and are called in the ngOnInit lifecyle hook.

We can add an alert to the listener and indeed when following the above steps and receiving a message, it gets duplicated. Also, checked to make sure the listeners are not getting fired more than once and that looks good.

I would suspect it’s an issue in our code but we have looked everywhere and it seems to be related to the Message Listener and when the device is locked/unlocked or the app is placed in the background and then brought back to the foreground.

Ionic 5.3
@cometchat-pro/cordova-ionic-chat”: “^2.0.11”

Thanks!
Kyle

Hello @kl2000,

We will get this checked on our end and get back to you with an update.

Warm Regards,

CometChat Pro
Mayur Bhandari