laravel
🚀
pusher
🚀
note2self
🚀
Note to Self: Setting up Echo Events
I tend to add
/**
* The event's broadcast name.
*
* @return string
*/
public function broadcastAs()
{
return 'chat';
}
I do this since the Laravel docs
Echo.private(`orders.${orderId}`)
.listen('OrderShipmentStatusUpdated', (e) => {
console.log(e.order);
});
But in the Pusher UI you can see it comes in as a full namesapce `\\App\\Events\\OrderShipmentStatusUpdated'
Echo in the Vue.js files then looks like this
Echo.channel(`editor.${this.$page.props.user.id}`)
.listen('.editor', (e) => {
})
.listen('.cliche', (e) => {
this.cliches_report = e.report.found;
})
.listen('.passive', (e) => {
this.passive_report = e.report.found;
})
Adding a "." in from of the listen.