I am wondering if there is any mechanism or hook which would fire when a component unmounts. I looked through both v2 and v3 docs and I couldn't find something like that.
Use case: I am looking to integrate Laravel Reverb into my app and I would like a hook to close the ws connection for a certain component with Echo.leave('channel-name').
For livewire 3
doing a quick search through the livewire code there is the following function within the ComponentHook.php file
this seems to imply if you add a destroy() function to your component class this would handle the "unmount"
it may be the case that you will need to implement some additional Alpine code to really get to the solution that you want.
again in the livewire codebase there is the following documentation: