hello, I think post is over a year old but I'm trying to use nuxtSocket with strapi. I have tried to implement code similar to yours but the methods defined in the nuxt.config.js aren't being recognized. This is a snippet of my nuxt.config.js
But I get the following error: -
TypeError: this.join is not a function
at VueComponent.mounted (_room.vue?9bf3:154)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at callHook (vue.runtime.esm.js?2b0e:4219)
at insert (vue.runtime.esm.js?2b0e:3139)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at Object.invoker as insert
at invokeInsertHook (vue.runtime.esm.js?2b0e:6346)
at Vue.patch as patch
at Vue._update (vue.runtime.esm.js?2b0e:3945)
at Vue.updateComponent (vue.runtime.esm.js?2b0e:4060)
hello, I think post is over a year old but I'm trying to use nuxtSocket with strapi. I have tried to implement code similar to yours but the methods defined in the nuxt.config.js aren't being recognized. This is a snippet of my nuxt.config.js
namespaces: {
'/room': {
emitters: [
'join + joinMsg --> roomInfo',
'leave + leaveMsg'
],
Then I use it in the _room.vue component like this:-
mounted() {
this.socket = this.$nuxtSocket({ channel: '/room' });
this.userRoomData = {user: this.username, room: this.$route.params.room};
this.join();
}
But I get the following error: -
TypeError: this.join is not a function
at VueComponent.mounted (_room.vue?9bf3:154)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at callHook (vue.runtime.esm.js?2b0e:4219)
at insert (vue.runtime.esm.js?2b0e:3139)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at Object.invoker as insert
at invokeInsertHook (vue.runtime.esm.js?2b0e:6346)
at Vue.patch as patch
at Vue._update (vue.runtime.esm.js?2b0e:3945)
at Vue.updateComponent (vue.runtime.esm.js?2b0e:4060)
Any help would be greatly appreciated
Thanks
What version of vue are you using? The code was tested against 2.6.x a while ago.
thanks for the reply, I'm using 2.6.12
Hi Richard, I actually got it to work out for me, without the namespaces. Thanks for the initial reply, I appreciate it.
Ok great.