Im using Framework7 and AngularJS. Lets say there is a page called: "something.js". In this page there is a socket.io method.
When loading the page once, the actions in the socket.io method will be fired only one time (which is correct).
When navigating to a different page and back to the page that runs the something.js file, the socket method will be fired twice and so for and so on.
somethine.js code:
socket.on("notification", function(notification) {
// some code here
});
Now the only above code is loaded twice, so first time loading the something.js file, notification will be popped once. Next time, notification will be loaded twice, then three times.
How to tell socket.io to load the socket.on one time, or delete it when leaving the page or something?
Is it related to AngularJS views engine or to Framework7? How to avoid this?