voryx/angular-wamp

$wamp.onchallenge is triggered twice

Closed this issue · 3 comments

I haven't dug very deep into this, but it appears that $wamp.onchallenge events are being triggered twice. Just doing this, the console message is output twice:

$scope.$on('$wamp.onchallenge', function (e, data) {
    console.log('foo');
    ...
});

In my particular setup, due to were I was taking the password from, it caused the wrong value to be resolved in the promise and the authentication to fail. Maybe you can see if you can reproduce the event being triggered twice, and if so how to fix that?

I'll look into this. Is it possible you're registering the event listener in a controller that gets created twice?

Actually yes, that seems to be it. Please ignore. Sorry for bothering. ^_^;;

This is actually one of the reason why I'm not crazy about using an event for the on challenge. I'm looking into other ideas that will prevent this issue in the future.