# Real-Time Reactions, Message Edits, and Deletions Not Displaying Properly

**URL:** <https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428>\
**Category:** Web\
**Created:** [August 15, 2024, 3:14pm UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428 "2024-08-15T15:14:10Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![girishspark](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@girishspark](https://forum.social.plus/u/girishspark)\
**Post date:** [August 15, 2024, 3:14pm UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/1 "2024-08-15T15:14:10Z")

</div>

When sending a new message, real-time features such as reactions, message edits, and deletions are not functioning as expected. These updates are not being displayed promptly or at all.

When i have creating channels the some time the channels taking long time to display in the channel list.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [August 15, 2024, 4:55pm UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/2 "2024-08-15T16:55:05Z")

</div>

Hello, to assist you better, could you please share the versions of your SDK and UIKit, along with the relevant code? Thank you.

---

<div class="post-metadata">

**Author:** ![girishspark](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@girishspark](https://forum.social.plus/u/girishspark)\
**Post date:** [August 16, 2024, 5:27am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/3 "2024-08-16T05:27:15Z")

</div>

TS SDK version: 6.29.0  
For the reaction code:-

```auto
const isMessageReactionRemoved = await ReactionRepository.removeReaction(
      'message',
      messageId,
      emoji,
    );

```

For the Delete code:-

```auto
const message = await MessageRepository.softDeleteMessage(this.msg.messageId);

```

For the Edit code:-

```auto
const updatedMessage = {
          data: {
            text: inputValue
          },
        };
        const { data: message } = await MessageRepository.updateMessage(this.msgUpdate.messageId, updatedMessage);

```

I have implement this code in angular 17 version.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [August 16, 2024, 8:29am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/4 "2024-08-16T08:29:50Z")

</div>

Hello @girishspark, have you tried implementing the live collection from the TypeScript guide? Here’s the link: [Live Objects/Collections](https://docs.amity.co/amity-sdk/core-concepts/live-objects-collections/typescript-live-objects-collections).

> **Live Object** and **Live Collection** helps in syncing data so you will always get the most recent one. New data gets automatically collected everytime when there is an update and user need not refresh to get the recent data

---

<div class="post-metadata">

**Author:** ![girishspark](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@girishspark](https://forum.social.plus/u/girishspark)\
**Post date:** [August 18, 2024, 12:15pm UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/5 "2024-08-18T12:15:12Z")

</div>

I reviewed the information, but it only covers posts, topics, and the subscribe function—there’s nothing related to message reactions, edits, or deletions.

How can I implement real-time updates for my messages and channels? I’m only working on chat with channels.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [August 19, 2024, 7:02am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/6 "2024-08-19T07:02:37Z")

</div>

Hello @girishspark , Have you tried using the following function for real-time updates in your messages and channels?

```javascript
const subscribeSubChannel = (subChannel: Amity.SubChannel) =>
  disposers.push(
    subscribeTopic(getSubChannelTopic(subChannel), (error) => {
      // handle error or updates here
    })
  );

subscribeSubChannel(subChannelData as Amity.SubChannel);

```

This should help in implementing real-time updates. Let me know if this addresses your needs or if you require further assistance.

---

<div class="post-metadata">

**Author:** ![girishspark](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@girishspark](https://forum.social.plus/u/girishspark)\
**Post date:** [August 19, 2024, 8:07am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/7 "2024-08-19T08:07:43Z")

</div>

I tried implementing the code for real-time message updates (editing, deleting, and reactions) within messages and channels, but it’s not working as expected. Could you please check the code to help me resolve this issue?

```auto
 getMessages(){
    const unsubscribe = MessageRepository.getMessages({
      subChannelId: this.channelId,
      limit: 100,
    }, ({ data: messages, onNextPage, hasNextPage, loading, error }) => {
      if (error) {
        // Handle any errors that occur during retrieving data
      }
      if (loading) {
        // Handle the loading state, e.g., show a loading spinner
      }
      if (messages) {
        this.getMessagesSort(messages)
        this.subscribeChannels(messages);
        this.nextPageFn = onNextPage
        this.hasMore = hasNextPage
        if (this.onFirst) {
          this.scrollToBottom();
          this.onFirst = false
        }
      }
    });
    this.disposers.push(unsubscribe);
  }
  private subscribeChannels(messages: Amity.Message[]) {
    messages.forEach(c => {
      if (!this.subscribedChannels.includes(c.messageId) && !c.isDeleted) {
        this.subscribedChannels.push(c.messageId);
        this.disposers.push(subscribeTopic(getChannelTopic(c)));
      }
    });
  }

```

```auto
async getChannels() {
    let param: any = {
      membership: 'member',
      limit: 100,
      types: ['conversation']
    }

    const unsubscribe = await ChannelRepository.getChannels(
      { ...param },
      ({ data: channels, onNextPage, hasNextPage, loading, error }) => {
        if (channels) {
          this.getFilter(channels, this.searchQuery)
        }
        this.subscribeChannels(channels);
        this.hasMore = hasNextPage;
        this.nextPageFn = onNextPage;
      },
    );
    this.disposers.push(unsubscribe);
  }
  private subscribeChannels(channels: Amity.Channel[]) {
    channels.forEach(c => {
      if (!this.subscribedChannels.includes(c.channelId) && !c.isDeleted) {
        this.subscribedChannels.push(c.channelId);
        this.disposers.push(subscribeTopic(getChannelTopic(c)));
      }
    });
  }

```

---

<div class="post-metadata">

**Author:** ![topAmity](https://avatars.discourse-cdn.com/v4/letter/t/a88e4f/32.png) [@topAmity](https://forum.social.plus/u/topAmity)\
**Post date:** [August 20, 2024, 6:31am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/8 "2024-08-20T06:31:58Z")

</div>

@girishspark Hi, Your code is wrong for this part `this.subscribeChannels(messages)`. The purpose of this function is to use in channel list page not in the chat room page and it need to be ` const subscribeChannels = (channels: Amity.Channel[])` not `subscribeChannels(messages: Amity.Message[])`.

---

<div class="post-metadata">

**Author:** ![topAmity](https://avatars.discourse-cdn.com/v4/letter/t/a88e4f/32.png) [@topAmity](https://forum.social.plus/u/topAmity)\
**Post date:** [August 20, 2024, 6:33am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/9 "2024-08-20T06:33:28Z")

</div>

I have one question. Were you able to receive messages in real-time when the user sent messages in the channel?

---

<div class="post-metadata">

**Author:** ![girishspark](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@girishspark](https://forum.social.plus/u/girishspark)\
**Post date:** [August 20, 2024, 7:32am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/10 "2024-08-20T07:32:09Z")

</div>

I mistakenly used the same function name, `subscribeChannels`, for both messages and channels. However, to subscribe to real-time updates, I used the correct Amity function, `subscribeTopic`, for both messages and channels. The duplicate function name was just a local oversight.

---

<div class="post-metadata">

**Author:** ![girishspark](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@girishspark](https://forum.social.plus/u/girishspark)\
**Post date:** [August 20, 2024, 7:34am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/11 "2024-08-20T07:34:42Z")

</div>

Yes, I receive messages in real time in the channel, but when I edit, delete, or react to a message, the updates are not reflecting.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [August 20, 2024, 11:16am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/12 "2024-08-20T11:16:03Z")

</div>

Hello @girishspark , Upon further investigation, we identified the issue you reported, and it has been resolved in the latest version. We recommend updating to TS SDK version 6.29.2 and checking if the problem persists.

Please let us know if you encounter any further issues or need additional assistance.

---

<div class="post-metadata">

**Author:** ![girishspark](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@girishspark](https://forum.social.plus/u/girishspark)\
**Post date:** [August 21, 2024, 9:57am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/13 "2024-08-21T09:57:58Z")

</div>

I updated the SDK version, and now the real-time edit and delete functions are working fine. However, the real-time reactions have become worse. When I add a reaction to a message, the message gets removed, and the reaction is applied to the previous message from the user.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [August 22, 2024, 7:01am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/14 "2024-08-22T07:01:20Z")

</div>

Hello @girishspark , We couldn’t reproduce the issue on our side. To assist you further, could you please provide the following:

1. The code related to the issue.
2. A screen recording showing the problem.
3. Detailed steps to reproduce the issue.

This information will help us investigate further. Thank you!

---

<div class="post-metadata">

**Author:** ![girishspark](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@girishspark](https://forum.social.plus/u/girishspark)\
**Post date:** [August 26, 2024, 4:58am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/15 "2024-08-26T04:58:45Z")

</div>

Please check the video link where I have reproduced the issue:([Countable (Staging) - 26 August 2024 | Loom](https://www.loom.com/share/bed4f27b691149cda5bc7da7d9a5a96a)).

I sent a message, and another user also sent a message. When I reacted to that message, the previous message was removed from the message list.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [August 26, 2024, 5:42am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/16 "2024-08-26T05:42:18Z")

</div>

Hello @girishspark , Thank you for providing additional info, we have passed it to our team to check this further.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [August 26, 2024, 7:17am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/17 "2024-08-26T07:17:22Z")

</div>

Hello @girishspark , We tried to replicate the issue on our end but couldn’t reproduce it. To help us investigate further, could you please provide the SDK logs? This will give us more insight into what’s happening and allow us to assist you more effectively.

Thank you for your cooperation.

---

<div class="post-metadata">

**Author:** ![girishspark](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@girishspark](https://forum.social.plus/u/girishspark)\
**Post date:** [August 27, 2024, 8:20am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/18 "2024-08-27T08:20:55Z")

</div>

There is to many logs in every behaviours so can you please suggest which specific logs you want to verify.

I have got another issue as well when i have removeing the rection the reaction api showing 404 error.

```auto
const isMessageReactionRemoved = await ReactionRepository.removeReaction(
      'message',
      id,
      emoji,
    );
{
    "referenceId": "66cd82f47643d961d7916608",
    "referenceType": "message",
    "reactionName": "👍",
    "referenceVersion": 5
}

```

 ![Screenshot 2024-08-27 at 1.48.38 PM](https://europe1.discourse-cdn.com/flex013/uploads/amity/original/1X/2e1ccb0f85c51451efe52c3e68cc50cd62fffdc4.jpeg)

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [August 27, 2024, 9:14am UTC](https://forum.social.plus/t/real-time-reactions-message-edits-and-deletions-not-displaying-properly/1428/19 "2024-08-27T09:14:11Z")

</div>

Hello @girishspark , We would need the logs from `getMessages()` right after adding or removing a reaction. These logs are essential to help us better understand and resolve the issue you’re encountering. Thank you for your cooperation.
