RPC session.call outside of onjoin? (Using twisted)

#1

Hi I’m using crossbar and autobahn py for RPC messenging, my problem is I want to send rpc calls whenever I want to.
Here’s a bit of code that explains it better:
class coolApp() {
constructor(name) {
this._name = name;
//Compiler obviously doesn’t know what session is.
session.call(‘com.coolExample’, name).then(
function(result) {
console.log(‘Started cool example’);
},
function (err) {
throw new TypeError(‘Failed to start cool example’,err);
}
);
}
}

``

Previously I’ve only been calling rpc methods on the onjoin callback. I’m sure there’s a better way to do it than just hammer some assembly style goto’s.

0 Likes