mirror of
https://github.com/tenrok/vue-native-websocket.git
synced 2026-06-21 13:20:35 +03:00
Merge pull request #65 from weglov/feature/fix-reconnection
Fix reconnection ws instance
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
This package is [semantic versioned](http://semver.org/)
|
This package is [semantic versioned](http://semver.org/)
|
||||||
|
|
||||||
|
## 2.0.9
|
||||||
|
- [bugfix]: fixed reconnection
|
||||||
|
|
||||||
## 2.0.8
|
## 2.0.8
|
||||||
- [feature]: custom pass to store logic. Defaults to original passToStore code if no custom logic provided
|
- [feature]: custom pass to store logic. Defaults to original passToStore code if no custom logic provided
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-native-websocket",
|
"name": "vue-native-websocket",
|
||||||
"version": "2.0.8",
|
"version": "2.0.9",
|
||||||
"description": "native websocket implemantation for vuejs and vuex",
|
"description": "native websocket implemantation for vuejs and vuex",
|
||||||
"main": "dist/build.js",
|
"main": "dist/build.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ export default {
|
|||||||
|
|
||||||
let observer = null
|
let observer = null
|
||||||
|
|
||||||
|
opts.$setInstance = (wsInstance) => {
|
||||||
|
Vue.prototype.$socket = wsInstance
|
||||||
|
}
|
||||||
|
|
||||||
if (opts.connectManually) {
|
if (opts.connectManually) {
|
||||||
Vue.prototype.$connect = () => {
|
Vue.prototype.$connect = () => {
|
||||||
observer = new Observer(connection, opts)
|
observer = new Observer(connection, opts)
|
||||||
|
|||||||
+4
-1
@@ -55,7 +55,10 @@ export default class {
|
|||||||
|
|
||||||
if (this.store) { this.passToStore('SOCKET_' + eventType, event) }
|
if (this.store) { this.passToStore('SOCKET_' + eventType, event) }
|
||||||
|
|
||||||
if (this.reconnection && eventType === 'onopen') { this.reconnectionCount = 0 }
|
if (this.reconnection && eventType === 'onopen') {
|
||||||
|
this.opts.$setInstance(event.currentTarget)
|
||||||
|
this.reconnectionCount = 0
|
||||||
|
}
|
||||||
|
|
||||||
if (this.reconnection && eventType === 'onclose') { this.reconnect() }
|
if (this.reconnection && eventType === 'onclose') { this.reconnect() }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user