2
0
mirror of https://github.com/tenrok/vue-native-websocket.git synced 2026-05-17 04:19:38 +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:
Philip Marais
2018-09-26 07:25:25 +02:00
committed by GitHub
parent d77cb655e2
commit 684ddfd78d
+4 -1
View File
@@ -13,7 +13,10 @@ export default {
}
if (opts.connectManually) {
Vue.prototype.$connect = () => {
Vue.prototype.$connect = (connectionAlternative) => {
if (connectionAlternative) {
connection = connectionAlternative
}
observer = new Observer(connection, opts)
Vue.prototype.$socket = observer.WebSocket
}