Closed gufyapk closed 4 years ago
yeah,me too!!!!!!!!!!!!!!!!11111
Same here, just downgraded to 3.0.5 and it worked again
Same for me , i also downgraded to 3.0.7
"... socket.io subscribe is not a function ... " Same here, downgraded to 3.0.7 from 3.0.9
+1
any of the options "this.sockets.subscribe"/"this.$sockets.subscribe","this.$socket.subscribe" not working. result => this.sockets.subscribe is not a function
Vue-Socket.io 3.0.9 sockets is not work
this.sockets.subscribe replaced by this.sockets.listener.subscribe
@ninbert
@gaoquanbing-ausxin, Great!!!!!
what about 'sockets' property in the vue instance?
sockets: { a() { console.log("something") } }
the console.log wont fire when a() is activated from the server
Because the bug in version 3.0.9, sockets: { a() { console.log("something") } }
does not work, u can do as follow: mounted() { this.sockets.listener.subscribe('a', (data) => { console.log("something") }) }
and the sockets is from vue-socket.io( import from main.js), and follow is my config
import VueSocketio from 'vue-socket.io'
Vue.use(new VueSocketio({ debug: true, connection: socketio('ws://xx.xx.xx.xx:10342', { path: '', autoConnect: false, transports: ['websocket', 'xhr-polling', 'jsonp-polling'] }) }))
@ninbert
@gaoquanbing-ausxin
and what to do in the state actions /mutations?
before it was
mutations: {
socketListenerA(){
console.log("something")
}
}
I don't know if I'm missing anything but seems connection between server and client can be created but on this version the listener function in the Vue life cycle methods does not seem to work
@princetc
Refer to the answers above,There are two options
Can solve the problem.
Waiting for the official new version.
Same for me , i also downgraded to 3.0.7
Can you use it normally after dropping to 3.0.7? My version has always been 3.0.7, it was still usable before, and problems have recently started.
this.sockets.subscribe is not a function
And i found
new Vue({
sockets:{
connecting() {
console.log('正在连接')
},
disconnect() {
console.log("Socket 断开");
},
connect_failed() {
cosnole.log('连接失败')
},
connect() {
console.log('socket connected')
},
welcome: data => {
cosnole.log('welcome', datat)
}
},
router,
store,
render: h => h(App)
}).$mount('#app')
All events here are not executed,All subscriptions in sockets are invalid Subscription must be used in the component
this.sockets.listener.subscribe()
Then
Vue-Socket.io: #welcome subscribe, component: undefined
@vue/cli 4.2.3 Vue-Socket.io 3.0.9
I use vue-socket.io 3.0.9 sockets is not normal,use 3.0.7 is ok,why?