probil/vue-socket.io-extended

NuxtJS with vuex

TheCherry opened this issue · 0 comments

Greetings,

I don't get your system working with nuxtjs + vuex.
If I use nuxtjs and make emits and subscriptions in a component, its work very well.
But If I try to do it with the store, I have no results.

plugin file:

import Vue from 'vue';
import { io } from 'socket.io-client';
import VueSocketIOExt from 'vue-socket.io-extended';

const socket = io('http://localhost:8080');

export default ({ store }) => {
    Vue.use(VueSocketIOExt, socket, { actionPrefix: 'SOCKET_', store });
}

example store file (I tried many variants, not only this one)

export const state = () => ({
    list: []
})

export const mutations = {
    SOCKET_TOKEN(arg1, arg2){
        console.log("console 1")
    },
    SOCKET_HELLO(arg1, arg2) {
        console.log("console 2")
    },
    SOCKET_token(arg1, arg2) {
        console.log("console 3")
    }
}