Send playerLeave message on close

This commit is contained in:
2025-10-10 22:53:01 +02:00
parent 79138f4b4c
commit 968652491e

View File

@@ -81,6 +81,10 @@
}
function leaveLobby() {
wsClient.sendMessage({
type: 'leaveGame',
player: data.user.email
})
wsClient.disconnect();
// In a real app, you'd likely redirect to another page here
}
@@ -98,7 +102,7 @@
onDestroy(() => {
// Clean up WebSocket connection when component is destroyed
wsClient.disconnect();
leaveLobby()
});
</script>