mirror of
https://github.com/tenrok/vue-native-websocket.git
synced 2026-06-24 09:40:37 +03:00
Make manually connection configurable
This commit is contained in:
+13
-8
@@ -8,15 +8,20 @@ export default {
|
|||||||
|
|
||||||
let observer = null
|
let observer = null
|
||||||
|
|
||||||
Vue.prototype.$connect = function () {
|
if (opts.connectManually) {
|
||||||
observer = new Observer(connection, opts)
|
Vue.prototype.$connect = function () {
|
||||||
Vue.prototype.$socket = observer.WebSocket
|
observer = new Observer(connection, opts)
|
||||||
}
|
Vue.prototype.$socket = observer.WebSocket
|
||||||
|
}
|
||||||
|
|
||||||
Vue.prototype.$disconnect = function () {
|
Vue.prototype.$disconnect = function () {
|
||||||
observer.reconnection = false
|
observer.reconnection = false
|
||||||
Vue.prototype.$socket.close()
|
Vue.prototype.$socket.close()
|
||||||
delete Vue.prototype.$socket
|
delete Vue.prototype.$socket
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
observer = new Observer(connection, opts)
|
||||||
|
Vue.prototype.$socket = observer.WebSockekt
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.mixin({
|
Vue.mixin({
|
||||||
|
|||||||
Reference in New Issue
Block a user