diff --git a/README.md b/README.md index 4874a06..c0f5b26 100755 --- a/README.md +++ b/README.md @@ -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) + ..... + } }) ```