Are observers made for socket connection?

I built a very basic community chat room, I’m able to add users, and send messages, unfortunately I have to refresh the screens/re-render the component to be able to see the new messages. Should channel observer fix the issue ?

Hello @jsharl in this case you should use message observer, here’s the sample code

useEffect(() => observeMessages(channelId, messages => console.log(messages)) , [])

Thank you Amity support for quick response.
Indeed, I tried this as the documentation says, but for one sent message, observeMessage is triggered multiple times.

@jsharl The team has acknowledged and I just got informed that they are working on this issue. We’re aiming to release the fix within next 2 releases, I will keep you posted once :pray::blush:

1 Like

Hello @jsharl could you please share us your sample usage code as well?

Sorry guys , I had to stop working on the chat room so i couldn’t provide you with a follow up.
Since I’m resuming building a chatroom, I can confirm that this part works pretty well now. Thank for the good work !

Hi @jsharl Thank you very much for the update :pray: