Hi Im trying to build a chat app using livewire use a presence channel in echo.
reading the laravel docs I would need to implement four methods,
Echo.joining .leaving .here and .listen
scanning the livewire source I found:
vendor/livewire/livewire/src/js/Component/index.js:381
registerEchoListeners() {
....
if (['channel','private'].includes(channel_type)) {
Echo[channel_type](channel).listen(event_name, (e) => {
store.emit(event, e)
})
} else if (channel_type == 'presence') {
Echo.join(channel)[event_name]((e) => {
store.emit(event, e)
})
} else if (channel_type == 'notification') {
Echo.private(channel).notification((notification) => {
store.emit(event, notification)
})
} else{
console.warn('Echo channel type not yet supported')
}
I see how private channel forwards its call to the listen method on the echo instance, what I dont see is How i could create a listner for joining, leaving etc. Could you please help?