Open fahmiegerton opened 3 years ago
This function, subscribe() and unsubscribe() is undefined when using this.$pusher in Nuxt.js. I already set the mode to client, follow the instruction, but nothing work. Here's the plugin vue-pusher.js fiile I made.
subscribe()
unsubscribe()
this.$pusher
import Vue from "vue"; // import VuePusher from "vue-pusher"; export default ({$config: {pusherKey, pusherCluster}}) => { Vue.use(VuePusher, {api_key: pusherKey, options: {cluster: pusherCluster, encrypted: false}}) }
And using it in the pages like this:
export default { ...... mounted() { this.pusher() }, methods: { pusher() { var channel = this.$pusher.subscribe('railway') channel.bind('01', (data) => { // do with the data }) }, ....... }, ..... }
Any idea what is wrong with this conifiguration? thank you
This function,
subscribe()
andunsubscribe()
is undefined when usingthis.$pusher
in Nuxt.js. I already set the mode to client, follow the instruction, but nothing work. Here's the plugin vue-pusher.js fiile I made.And using it in the pages like this:
Any idea what is wrong with this conifiguration? thank you