-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Emit to socket from inside vuex store's mutations, actions functions #337
Comments
From the vue-3-socket.io's source point of view, possibly injecting the socketIO instance into the vuex instance would break the design pattern. So I like to share this small code snippet, that solved my issue by injecting vue-3-socket.io into the vuex store via main.js: main.js:
Following is some usage Example: store.js:
socket.js:
Express server's index.js:
app.vue:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://lukashermann.dev/writing/socketio-with-vue-and-vuex/
Layed out some way to emit to socket from inside vuex store's action functions. But would it not be nicer to have this feature here? And if it already exists, please add some example code to the docs.
Kind regards.
The text was updated successfully, but these errors were encountered: