Uncaught TypeError: Cannot read property 'name' of undefined
at laravel.app.js:14949
This won't have worked event it did not display because you see it displays private when event broadcasted to private channel which is handled by the server-side of the code. i.e. When we do return new PrivateChannel(...)
Which is
isTyping() {
let channel = Echo.private('groups.' + this.group.id);
setTimeout(function() {
channel.whisper('typing', {
user: this.currentUser.name, // THIS LINE
typing: true
});
}, 300);
},
Use arrow functions if you're using this inside instead of anonymous function.
The typing indicator can be sorted afterwards, just need to get the name displaying when the message as been sent, so I commneted out the isTyping for now to remove that error I sent.
Does it work now?
The message does show on the other users account, however the name does not
Unless I refresh the page
You need to debug it step by step because if you're message showing up, then it works. You might have some other issue somewhere in your code.
Yeah and just put isTyping back and changed to arrow function and that all works now, so just need to figure out the name issue.
Thank you greatly both @bryank & @mkshingrakhiya
Please choose the best solution that worked out for you for this thread. Post here if you encounter other other subject related issues.
I can't give a best solution as you were both helpful.
Just comment the solution by yourself and mark it as the best answer. It will help others.
Please or to participate in this conversation.