- I am building an application in Vue with socket connections.
- The app allows the user to view the content as an authenticated user and as anonymous.
- After logging in, the idea is to be able to target specific clients with data - eg "someone commented on your input".
- Before logging in, we are not interested in the socket connections.
- The login should be seemless and should not reload the whole page.
- I'm looking into using a polished lib to be able to automagically inject the socket awareness into components with: https://github.com/probil/vue-socket.io-extended#readme
Apart from the socket connections, the app is built.
Based on that plugins readme, this is how i would go about injecting the lib into the app:
var socket = io('http://socketserver.com:1923');
Vue.use(VueSocketIOExt, socket);
This is all fine, but i am stuck when i don't want to inject the socket connection into the app.
QUESTION:
As in 1 use case I would like to establish the socket connection after the app has initialised: Is it possible in Vue to call Vue.use(VueSocketIOExt, socket);
after initialization?
(ie in this case; after the user has loaded the app and then authenticated themselves)