I am making a chatroom App by the blazor server-side.
I want to show the online state of each user.
Now I can use the OnAfterRenderAsync
event to get a user has entered the page.
It seems there is not any exit
event in blazor lifecycle via https://learn.microsoft.com/en-us/aspnet/core/blazor/lifecycle?view=aspnetcore-3.1
Someone said I can use the Dispose
event to achieve it while it does work at all.
What's more, I have a crazy idea that using the window.onbeforeunload
event of js to invoke the blazor method.
I have no idea which one is best. Would you please give me a suggestion? Thank you.