Have you tried this to detect if the browser has been closed ?
window.addEventListener('beforeunload', function (e) {
e.preventDefault();
// some action
});
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello everyone,
I'm currently developing a Laravel Reverb project and need to broadcast events when someone joins or leaves a presence channel. Specifically, I'm looking to handle scenarios where someone disconnects their internet or closes their browser window. How can I achieve this server-side? Any advice, examples, or best practices would be incredibly helpful!
Thank you in advance!
Please or to participate in this conversation.