Closed rcampion closed 2 years ago
This only happens when the chat window has not been opened yet.
Fixed by saving state using onParticipantChatOpened and onParticipantChatClosed.
The problem was that I send a WebSocket message and save history to database within sendMessage and I call onMessageRecieved after I receive the WebSocket message.
Now I use a DataSharing service to maintain participant state and only call triggerOpenChatWindow when chat window is closed. Only call onMessageRecieved when chat window is open.
Seems to be working fine.
I managed to get a reference to the ngChatInstance from within the chat adapter.
I call triggerOpenChatWindow when I receive a message.
Now I have implemented getMessageHistory and getting the data from a web service.
When the first time a chat participant window is opened, I am getting two messages instead of one.