In my ionic app, i have a service that has an instance of a websocket, in the constructor method, i create the socket and pass the reference to it to the pages that need it, Aren’t services supposed to be singleton? as i’m getting multiple instances of the sockets as i navigate between pages.
Also for this page i’ve set ViewEncapsulation to None if it makes any difference.
So what you are probably seeing is that the pages that are in the navigation stack are not destroyed when you navigate away from them. So any subscriptions/logic that are in place will still log out values. So you’re not seeing multiple subscriptions, but multiple logs all from the same singleton…if that make sense
To add to what @mhartington said, I would suggest moving the subscription to ngOnInit (since you’re already implementing it), and tearing it down in ngOnDestroy. The ngneat/until-destroy decorator provides a clean way of doing this, but you can always manually manage it if you prefer.