Hi @HOUSSEM MAHJOUBI ,
As far as I think.it's impossible to check if the tab is closed. When the user request to the server,the server will get connected status.But the server couldn't know when the user disconnected. You need to learn more about Request.
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Yijing Sun