I have yet to find a solution or any information on this topic. Basically I am developing a chat app with flask, socketio, and angularjs. I created a single page app with angularjs so when I click for example a register button this page comes into view even though it is not actually routing to a new page. The problem is when I click the register button or switch views another socket connection gets created. So when I go back to the chat app view to send a message it sends 3 messages because 3 sockets were created. One initially, one when I went to register view and the third socket connection was created when I went back to chat app view. So I have a few questions about this behavior:
In a non-SPA would this behavior still happen?
Does a socket get disconnected when switching pages in a non-SPA?
With my issue I can see that changing views in a SPA creates another socket but it does not delete a socket. How do I avoid having multiple socket connections so I do not send multiple messages/events for a single sent message event?
Thanks a lot guys.