I would like to make sure a user is logged in before they are sending chats. To do this, should I use a authentication middleware that triggers on every connection or use a middleware that trigger on each event?
I am worried if I use the former, the user can sign in then signout (without losing the connection) and continue to send messages while not logged in).
However, looking through all the different stackoverflow posts, no one has mentioned this issue. Can anyone tell me what approach is commonly used?