-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: this.$socket.$unsubscribe is not a function #431
Comments
Try version Thanks for your issue BTW 👍 |
@probil seems like the issue exists in When the page is loaded the first time and the Vue instance is Could this be the cause of it? |
I'm having the same issue. When I change the route and come back, the $subscribe is not available anymore. |
I am still facing this issue |
I am also facing this issue. Will this be fixed soon? |
@probil Issue still not resolved. This is a pretty big issue as it renders the $subscribe and $unsubscribe useless |
It seems like introducing For now you can attach events directly on the socket instance, e. g.: // subscribe
this.$socket.client.on('eventName', () => {
// some code here
})
// unsubscribe
this.$socket.client.off('eventName', () => {
// some code here
}) |
Will try to check other use cases and probably release the next version without |
Has anyone found a solution for this? I am actively experiencing it. |
@TBetcha The solution is mentioned above |
// App.vue
mounted(){
this.$socket.client.off('userSubscription');
//this.$socket.client.on('userSubscription', (payload) => {console.log(payload)});
}, // server
socket.emit('userSubscription','Send this message to only those who subscribed'); plz show me how to handle this on server side because even though i write |
@19apoorv97 There is one important thing I haven't mentioned. You need to pass the same function to export default {
methods: {
onEventName() {},
},
mounted() {
// subscribe
this.$socket.client.on('eventName', this.onEventName)
},
beforeDestroy() {
// unsubscribe
this.$socket.client.off('eventName', this.onEventName)
},
} |
Please take a look at the following link on
App.vue
line38
and39
Example Link
The
$subascribe
function does not exist.The text was updated successfully, but these errors were encountered: