rpaschoal / ng-chat

💬 A simple facebook/linkedin lookalike chat module for Angular applications.
MIT License
155 stars 92 forks source link

How to use **onMessagesSeen** event to mark messages as read on my database #75

Closed rpaschoal closed 5 years ago

rpaschoal commented 5 years ago

Moving this to a new issue as we can discuss it further here and within context:

How i can get call when onMessagesSeen event triggered. how to implement this in my adapter or component, any sample code.(i want to mark them read in my database). thanks in advance.

Originally posted by @MuhammadRizwanBashir in https://github.com/rpaschoal/ng-chat/issues/72#issuecomment-429624551

rpaschoal commented 5 years ago

@MuhammadRizwanBashir some instructions on this shared by @FShieldheart on #72

Here what I did in my project. I wrote a service and injected into my component which has the "onMessagesSeen" method. This service uses an API to persist unread messages as read in the data store. Also, the same API sends a signal to the receiver via SignalR upon successful completion of the transaction so that sender is notified of the messages which have read (assuming sender is online at the time of this flow). Hope it helps.

rpaschoal commented 5 years ago

Hi @MuhammadRizwanBashir,

Have you managed to get this working?