From 156f42b45de2cfc1a4a37b3f4e5cfa2691eaa3ab Mon Sep 17 00:00:00 2001 From: guillaume Date: Fri, 31 Aug 2018 01:29:33 +0200 Subject: [PATCH 1/2] 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) + ..... + } }) ``` From 690b6ca87035eb7100956bd7aa7648e36e8f902e Mon Sep 17 00:00:00 2001 From: guillaume Date: Fri, 31 Aug 2018 01:31:31 +0200 Subject: [PATCH 2/2] typo but online ;) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c0f5b26..83fed54 100755 --- a/README.md +++ b/README.md @@ -162,14 +162,14 @@ export default new Vuex.Store({ SOCKET_RECONNECT_ERROR(state) { state.socket.reconnectError = true; }, - } -}, -actions: { + }, + actions: { sendMessage: function(context, message) { ..... Vue.prototype.$socket.send(message) ..... } + } }) ```