From 156f42b45de2cfc1a4a37b3f4e5cfa2691eaa3ab Mon Sep 17 00:00:00 2001 From: guillaume Date: Fri, 31 Aug 2018 01:29:33 +0200 Subject: [PATCH] more documentation to send a WS message with VueX more doc. this save my file today ;) --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) 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) + ..... + } }) ```