[Vuejs]-Start socket connection after some action vuejs

0👍

If you’re using vue-router you can do the following:

{
   path: '/BB',
   name: 'BB',
   component: BB,
   beforeEnter (to, from, next) {
      if (!Vue.prototype.$socket) { 
         Vue.use(VueSocketio, WS_URL)
      }
      next()
   }
}

Source: How to disabled vue-socket.io in some vue-router component

Leave a comment