Websocket listener removed when navigating out of the page

Hi, so I’m using websockets to get push notifications when an event happens. I listen to that event on one page, but looks like when I navigate out of that page, that subscription is lost, and when the backend sends the event nothing happens on ionic. It only listens to the event when I’m on the page I defined the listener. Is there a way I can have like a root place where I define an event listener for the whole application, where I don’t mind in which page I’m in, but if the backend sends the event I can listen to it in ionic?
btw I’m using ionic 2.


That sounds like the app component to me.

I actually put the listener code in app component

this.eventsChannel.on("new_event", (resp) => console.log("event"));

but when the backend sends the event, nothing happens