I am Using Vue.js as the front-end framework.
I am adding the socket.io listener on a component using created life-cycle hook.
created () {
// socket listener
this.$socket.on('event', (response) => { .... })
}
Now if the component is unmounted and later remounted then two listener are created.
I tried using "once" in place of "on" but same problem.
How Can I make sure that only one Listener is active?
Note: The socket component is added to Vue as Instance Property.