Hi guys,
Im trying to solve an issue within my application, where the user types some message, the sendUserMessage function throws me an error, i tried to look everywhere why and how is that error happening but no clue.
here’s the code where the function is called:
sendMessage(message: string, currentGroupChannel: SendBird.GroupChannel):
Observable<SendBird.UserMessage | SendBird.FileMessage | SendBird.AdminMessage> {
const params = new this.sendBird.UserMessageParams();
params.message = message;
params.pushNotificationDeliveryOption = 'default';
return new Observable<SendBird.UserMessage | SendBird.FileMessage | SendBird.AdminMessage>((observer) => {
currentGroupChannel.sendUserMessage(params, (messageFromSendBird, error) => {
if (error) {
observer.error(error);
observer.complete();
} else {
observer.next(messageFromSendBird);
observer.complete();
}
});
});
}
here the error
core.js:15724 ERROR TypeError: Cannot assign to read only property 'lastMessage' of object '[object Object]'
at SendBird.min.js:6
at SendBird.min.js:6
at e.value (SendBird.min.js:6)
at e.u.onMessage (SendBird.min.js:6)
at WebSocket.ws.onmessage [as __zone_symbol__ON_PROPERTYmessage] (SendBird.min.js:6)
at WebSocket.wrapFn (zone.js:1332)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17290)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)