I was trying to laravel echo with pusher in 5.4 for boradcasting a event. But the problem i'm facing I can't broadcast the event properly. Instead of it I'm getting the following Error>>
Uncaught ReferenceError: Echo is not defined
Here is the code in app.js:
created(){
axios.get('messages').then(response => {
// console.log(response);
this.messages = response.data;
});
Echo.join('chatroom')
.here((users)=> {
this.usersInRoom = users;
})
.joining((user)=>{
this.usersInRoom.push(user);
})
.leaving((user)=>{
this.usersInRoom = this.usersInRoom.filter(u=>u !=user)
})
.listen('messagePosted',(e)=>{
this.messages.push({
message:e.message.message,
user:e.user
});
// console.log(e);
});
}
Can anyone suggest what's the Error with the Echo please?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kxA5j9
via IFTTT
Aucun commentaire:
Enregistrer un commentaire