Problem with event names marked with "-"
tachibana-shin opened this issue · 2 comments
tachibana-shin commented
hi on the server I have an event named "SERVER__newAnswer-comment" how can I listen for the event on the client
probil commented
- On Component
new Vue({
sockets: {
connect() {
console.log('socket connected')
},
'SERVER__newAnswer-comment'(val) {
console.log('this method was fired by the socket server. eg: io.emit("customEmit", data)')
}
},
})
- On Vuex Store
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex);
const messages = {
mutations: {
'SOCKET_SERVER__NEWANSWER-COMMENT'(state, message) {
// your implementation here
}
},
actions: {
socket_serverNewAnswerComment() {
// your implementation here
}
}
};
probil commented
@NguyenThanh1995 Let me know if it helped