2
0
mirror of https://github.com/tenrok/vue-native-websocket.git synced 2026-06-22 14:30:34 +03:00

Fixes for empty sub-protocol and missing action names (#8)

* 1. Fixed DOMException: Failed to construct 'WebSocket': The subprotocol '' is invalid. in Chrome when empty protocol arg passed in WS ctor.  2.  Action name was never being set/executed on incoming messages.

* upated docs
This commit is contained in:
Mark Macneil
2017-07-10 13:09:10 -03:00
committed by Nathan
parent 46e251dcbc
commit 55aa4a75aa
3 changed files with 12 additions and 3 deletions
+9 -1
View File
@@ -145,7 +145,15 @@ If there is a `.namespace` on the data, the message is sent to this `namespaced:
If there is a `.mutation` value in the response data, the corresponding mutation is called with the name `SOCKET_[mutation value]`
If there is an `.action` value in the response data, the corresponding action is called with the name `SOCKET_[action value]`
If there is an `.action` value in the response data ie. `action: 'customerAdded'`, the corresponding action is called by name:
``` js
actions: {
customerAdded (context) {
console.log('action received: customerAdded')
}
}
```
Use the `.sendObj({some: data})` method on the `$socket` object to send stringified json messages.