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

Merge pull request #66 from gbtux/vuex_socket

Vuex socket
This commit is contained in:
Viktor
2018-09-12 15:57:16 +03:00
committed by GitHub
+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) {
@@ -161,6 +162,13 @@ export default new Vuex.Store({
SOCKET_RECONNECT_ERROR(state) {
state.socket.reconnectError = true;
},
},
actions: {
sendMessage: function(context, message) {
.....
Vue.prototype.$socket.send(message)
.....
}
}
})
```