rpaschoal / ng-chat

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

Why chat history shows same message history for all the users? #101

Closed riteshbathwal closed 5 years ago

riteshbathwal commented 5 years ago

Hi I am using the Offline Bot Adapter. The issue that I face is that even if I set my getMessageHistory() method lilke below, I am not getting different messages from UserID1 and UserID2 , infact I am getting same two messages for all the users. How should I configure message history so that different message history is shown in different message window?

getMessageHistory(userId: any): Observable<Message[]> { console.log("getMessageHistoryCalled --> Only Once"); let mockedHistory: Array;

    mockedHistory = [                    
        {
            fromId: 1,
            toId: 999,
            message: "Hi there, just type any message bellow to test this Angular module."
        },
        {
            fromId: 2,
            toId: 999,
            message: "my custom msg"
        }
    ];

    return of(mockedHistory);
}
rpaschoal commented 5 years ago

Hi @riteshbathwal ,

The offline bot is just a really simple example. You need to implement your own logic to fetch a user's history. You could for example send an API request with the userId to fetch the history from your application and then return its observable.

riteshbathwal commented 5 years ago

Got it, thanks

MPTA commented 3 years ago

hello , i have implemented my logic api and get messages from server but all messages shown in the left side , (the sender and receives Id already set and is correct information but shown is only in the left side)