Skip to content

Commit

Permalink
Merge pull request #66 from gbtux/vuex_socket
Browse files Browse the repository at this point in the history
Vuex socket
  • Loading branch information
weglov authored Sep 12, 2018
2 parents 4420299 + 690b6ca commit 432b1de
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
.....
}
}
})
```
Expand Down

0 comments on commit 432b1de

Please sign in to comment.