mirror of
https://github.com/tenrok/vue-native-websocket.git
synced 2026-06-17 22:20:34 +03:00
Added connection variable for manual-connect
Added the option to connect to a connection other than the connections dictated in the instantiation.
Can be used as usual with `this.$connect()`, or alternatively `this.$connect('ws://localhost:port/foo/')` to specify a different socket endpoint/channel.
This commit is contained in:
+4
-1
@@ -13,7 +13,10 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opts.connectManually) {
|
if (opts.connectManually) {
|
||||||
Vue.prototype.$connect = () => {
|
Vue.prototype.$connect = (connectionAlternative) => {
|
||||||
|
if (connectionAlternative) {
|
||||||
|
connection = connectionAlternative
|
||||||
|
}
|
||||||
observer = new Observer(connection, opts)
|
observer = new Observer(connection, opts)
|
||||||
Vue.prototype.$socket = observer.WebSocket
|
Vue.prototype.$socket = observer.WebSocket
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user