lajosbencz / vue-wamp

AutobahnJS wrapper library fo Vue.js
MIT License
48 stars 13 forks source link

Wamp Events won't work #23

Open ingles98 opened 4 years ago

ingles98 commented 4 years ago
...
  mounted() {
    this.$on('$wamp.status', ({status, lastStatus, details}) => {});
    this.$on('$wamp.opened', ({status, lastStatus, details}) => {});
    this.$on('$wamp.closed', ({status, lastStatus, details}) => {});
    this.$on('$wamp.retrying', ({status, lastStatus, details}) => {});
    this.$on('$wamp.reconnected', ({status, lastStatus, details}) => {});
  },
...

I tried the aobve example, with console.log(status) on each callback but it is never called.

ARoddis commented 4 years ago

Doesnt seem to work properly at the moment.

Workaround:

this.$wamp or Vue.Wamp returns the actual connection...you can use .on on that.

 self.$wamp.on('status', ({status, lastStatus, details}) => {
              console.log(status, lastStatus, details);
            });
            self.$wamp.on('opened', ({status, lastStatus, details}) => {
              console.log(status, lastStatus, details);
            });
            self.$wamp.on('closed', ({status, lastStatus, details}) => {
              console.log(status, lastStatus, details);
            });
            self.$wamp.on('retrying', ({status, lastStatus, details}) => {
              console.log(status, lastStatus, details);
            });
            self.$wamp.on('reconnected', ({status, lastStatus, details}) => {
              console.log(status, lastStatus, details);
            });