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:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user