[Vuejs]-How to connect to socket with Socket.io-client in Vue-cli app

0👍

Someone correct me if I’m wrong, but I think you should not set the socket connection in the action. Only the requests to/from Socketio.

You don’t need to make the connection everytime the action is called, Socketio will handle the connection until it’s closed or the client gets disconnected.
Just make the connection one time with calling the mutation SOCKET_CONNECT (using commit), for example from your main Vue file.

See the example below : https://github.com/MetinSeylan/Vue-Socket.io

Leave a comment