onMemberAddedToGroup called twice when you add a member to a group

When adding a member to a group, the CometChatGroupDelegate is calling the onMemberAddedToGroup for an action. When debugging, I can see that the same message is being received twice. I can see that it is the same message because the first and the second message have the same message.id. The member is added to the group via Web API that is called on the mobile side. It could be related to this CometChatMessageDelegate not called after creating a Group.

This is happening on v.2.0.8-beta1

Hi @jeraldo

Thanks for reporting it. Can you please provide the end point url that you have used for adding member to group.

Thanks Nishant. Here is the API we use.

Hi @jeraldo

We are unable to replicate the issue at our end. Can you please provide some more information or a video of it would also be great. Still we are trying it multiple time to reproduce it. Let me know if I have performed correct steps to reproduce it.

  1. Created a group via api
  2. Added a member in that group via api
  3. Attached debugger on delegate onMemberAddedToGroup before adding member to group via api
  4. Waited to see how many times the delegate method is called

Do let us know if I have done all the correct steps to reproduce also is there any special scenario e.g was this member added first and remove and then added again? Do let us know so that we can find the root cause of it.

Thanks for checking on your side @nishant.tiwari. I will check with our back end developer on what and how he is calling the API. Is there any other reason why the onMemberAddedToGroup will be called? As far as I know, once you add a member to a group and you are a part of that group, this delegate method is called and you receive the action message. But if adding a participant only produces one message for that action, I wonder what could be causing the delegate to be called twice.

Hello @jeraldo,
It would be great if you could check with your back end developer. We are still trying to replicate this at our end and would like to know a couple of things that would help us understand the scenario better. Firstly, i would like to know if the delegate is called twice every time a member is added to the group or does this happen randomly and not every time . Secondly, i would like to know that the delegate is only getting triggered twice for the user that is being added to group and foe all the other members of the group the delegate is being triggered only once ?
Do let us know how the api is called in the backend too.

Hi @aditya.gokula to answer some of your questions:

  1. Yes every time that a user is added by the current user, the delegate method is called twice. However, if the user was added by another user on the group that the current user is on, the delegate method is only called once on the current user’s side. This is what happens every time.
  2. No, it happens to all users.

I’ll get back once I get answers from our back end dev.


Hi @jeraldo

Any update on this? So that we can help you out and provide you a solution on same to make your integration journey smooth and hassle free.