When am sending new message it goes to all the distinct group channel, and it shouldn't be like this by default. Any suggestion appreciated.
For messaging part I have to array to store previous and new messages and load it when it is need.
The language is used is react.js and it is for simple web-app.
sendMessage(message) {
const data = '';
const customType = '';
this.state.currentChannel.sendUserMessage(message, data, customType, (mess, error) => {
if (error) {
console.error(`error sending message: ${error}`);
return;
}
console.log(`message sent!! ${mess}`);
console.log(mess);
const messagesState = this.state.messages;
messagesState.push(mess);
this.setState({
messages: messagesState,
});
});
}
Is there anything wrong in this part ?!
Just add an empty array before each channel handler.
message = [];
channelHandler = currentChannel;