2
0
mirror of https://github.com/tenrok/vue-native-websocket.git synced 2026-05-26 06:24:05 +03:00

more documentation to send a WS message with VueX

more doc.
this save my file today ;)
This commit is contained in:
guillaume
2018-08-31 01:29:33 +02:00
committed by GitHub
parent b7f3a454b2
commit 156f42b45d
+8
View File
@@ -142,6 +142,7 @@ export default new Vuex.Store({
},
mutations:{
SOCKET_ONOPEN (state, event) {
Vue.prototype.$socket = event.currentTarget
state.socket.isConnected = true
},
SOCKET_ONCLOSE (state, event) {
@@ -162,6 +163,13 @@ export default new Vuex.Store({
state.socket.reconnectError = true;
},
}
},
actions: {
sendMessage: function(context, message) {
.....
Vue.prototype.$socket.send(message)
.....
}
})
```