Code Monkey home page Code Monkey logo

vue-pusher's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vue-pusher's Issues

subscribe() and unsubscribe() is undefined when using this.$pusher in Nuxt.js

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.

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

logToConsole

Almost exactly what I was after though there doesn't seem to be the interface for turning on debugging, e.g.

Pusher.logToConsole = true

Am I missing something?

Add support for Vue 3 (errors due to Global API changes)

Trying to install the plugin on a Vue 3 project (w/ Nuxt 3) it errors:

500
Cannot set properties of undefined (setting 'pusher')

at Object.install (http://localhost:3000/_nuxt/node_modules/.vite/deps/vue-pusher.js?v=ae3370f2:6061:30)
at Object.use (http://localhost:3000/_nuxt/node_modules/.vite/deps/vue.js?v=ae3370f2:4690:18)
at http://localhost:3000/_nuxt/plugins/pusher.client.js:4:18
at fn (http://localhost:3000/_nuxt/node_modules/.pnpm/[email protected]/node_modules/nuxt/dist/app/nuxt.mjs?v=ae3370f2:141:27)
at callWithNuxt (http://localhost:3000/_nuxt/node_modules/.pnpm/[email protected]/node_modules/nuxt/dist/app/nuxt.mjs?v=ae3370f2:146:12)
at applyPlugin (http://localhost:3000/_nuxt/node_modules/.pnpm/[email protected]/node_modules/nuxt/dist/app/nuxt.mjs?v=ae3370f2:92:29)
at applyPlugins (http://localhost:3000/_nuxt/node_modules/.pnpm/[email protected]/node_modules/nuxt/dist/app/nuxt.mjs?v=ae3370f2:101:11)
at async initApp (http://localhost:3000/_nuxt/home/akiraserikawa/Sites/nuxt-demo/node_modules/.pnpm/[email protected]/node_modules/nuxt/dist/app/entry.mjs:39:7)

this caused by changes in Vue 3, where Vue.prototype does not exist anymore, so the plugin cannot work:

module.exports = {
    install: function (Vue, options) {
        var pusher = new VuePusher(options.api_key, options.options);

        Vue.prototype.pusher  = pusher;
        Vue.prototype.$pusher = pusher.pusher; // Just in case they want to manage it themselves.
    }
};

I guess it would require the plugin to use app.config.globalProperties instead.

https://vuejs.org/api/application.html#app-config-globalproperties

Update Pusher Version

Getting errors on some browsers that can't connect to pusher 4.2.1, is there a place we can update which version of pusher is being loaded or can you update to 4.3.*

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.