Livewire chat, echo-presence channel

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?

It’s a year old question but I just found out the solution:

class ChatBox extends Component
{
	public function getListeners()
	{
                // "online" is my broadcast channel name in routes/channel.php
		return [
                    'echo-presence:online,here' => 'here',
                    'echo-presence:online,joining' => 'joining',
                    'echo-presence:online,leaving' => 'leaving',
                ];
	}
        
        public function here()
        {
            //...
        }
        //...
}

I hope it helps someone.