voryx / angular-wamp

An AngularJS library for AutobahnJS (WAMP v2)
MIT License
133 stars 28 forks source link

Need to set session.caller_disclose_me #41

Closed 27leaves closed 9 years ago

27leaves commented 9 years ago

Hello,

I need to set the caller_disclose_me flat on the session, but it seems that it doesn't work. Do you know why that could be? autobahnjs is on version 0.9.8. (I tried it without angular-wamp on the same server and that works)

$rootScope.$on('$wamp.open', function (event, info) {
    console.log('We are connected to the WAMP Router!', event, info);
    info.session.caller_disclose_me = true;
    $rootScope.$emit('flatoutAuth:connected', info);
});

Thank you very much!

davidwdan commented 9 years ago

@creat-or as far as I can tell, that should work. I tried your code and inspected session and it is setting the _session.caller_disclose_me property to true on the session.

The only thing I can think of is that the RPC calls are being made before that property is set (all wamp actions are queued until the connection is opened).

Can you make an RPC request inside of your $wamp.open after you set caller_disclose_me? If that works, I may have to add those options to $wampProvider.init, so that they're set before any of the queued calls are made.

27leaves commented 9 years ago

OK, I'm sorry. It is NOT a problem of $wamp I guess. I now tried to connect it in a plunkr and it is working. In my app, however the session object looks slightly different. Do you know what can be the cause that I have no session._caller_disclose_me? (All calls are made after the $wamp.open, btw)

session object on plunkr:

{
  "_socket": {
    "info": {
      "type": "websocket",
      "url": "ws://xyz.com:3001/router",
      "protocol": "wamp.2.json"
    }
  },
  "_id": 3280489845536672,
  "_realm": "gateway",
  "_features": {
    "subscriber": {
      "publisher_identification": true,
      "pattern_based_subscription": true,
      "subscription_revocation": true
    },
    "publisher": {
      "publisher_identification": true,
      "subscriber_blackwhite_listing": true,
      "publisher_exclusion": true
    },
    "caller": {
      "caller_identification": true,
      "progressive_call_results": true
    },
    "callee": {
      "caller_identification": true,
      "pattern_based_registration": true,
      "shared_registration": true,
      "progressive_call_results": true,
      "registration_revocation": true
    }
  },
  "_goodbye_sent": false,
  "_transport_is_closing": false,
  "_publish_reqs": {},
  "_subscribe_reqs": {},
  "_unsubscribe_reqs": {},
  "_call_reqs": {},
  "_register_reqs": {},
  "_unregister_reqs": {},
  "_subscriptions": {},
  "_registrations": {},
  "_invocations": {},
  "_prefixes": {},
  "_caller_disclose_me": false,
  "_publisher_disclose_me": false,
  "_MESSAGE_MAP": {
    "8": {}
  },
  "_created": 412.57000000000005
}

session object on my app (no _caller_disclose_me or _publisher_disclose_me like above)

{
  "_socket": {
    "info": {
      "type": "websocket",
      "url": "ws://xyz.com:3001/router",
      "protocol": "wamp.2.json"
    }
  },
  "_id": 3995591735374458,
  "_realm": "gateway",
  "_features": {
    "subscriber": {
      "publisher_identification": true
    },
    "publisher": {
      "subscriber_blackwhite_listing": true,
      "publisher_exclusion": true,
      "publisher_identification": true
    },
    "caller": {
      "caller_identification": true,
      "progressive_call_results": true
    },
    "callee": {
      "progressive_call_results": true
    }
  },
  "_goodbye_sent": false,
  "_transport_is_closing": false,
  "_publish_reqs": {},
  "_subscribe_reqs": {},
  "_unsubscribe_reqs": {},
  "_call_reqs": {},
  "_register_reqs": {},
  "_unregister_reqs": {},
  "_subscriptions": {},
  "_registrations": {},
  "_invocations": {},
  "_prefixes": {},
  "_MESSAGE_MAP": {
    "8": {}
  },
  "_created": 1750.89
}
27leaves commented 9 years ago

Oh I'm so sorry. I installed autobahn via bower with autobahnjs but needed to install autobahn. So I had the old 0.9.6 version in the system and this caused the issue. 😲