You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, one can define interfaces with methods and register them under application objects, but there is no way to respond to method calls after methods are invoked.
In terms of the API how this is exposed, alternatives include at least extending the addListener interface for returning values from the callbacks or defining a new interface like addMethodImplementation that has mechanism to handle returns.
See the comment at #26 (comment) for background information.
The text was updated successfully, but these errors were encountered:
var doSomethingHandler = function(msgForReply) {
// If needed, get the received message with msgForReply.message
var getRandomInt = function() {
return Math.floor(Math.random() * (100 - 0)) + 0;
};
var r = getRandomInt();
if(r < 50) {
msgForReply.replySuccess('s', ["A successful result argument"]);
} else {
msgForReply.replyError('bad luck my friend' + r);
}
};
bus.addListenerForReply([1,0,0,1], 's', doSomethingHandler);
Currently, one can define interfaces with methods and register them under application objects, but there is no way to respond to method calls after methods are invoked.
In ajtcl code, this is done with the
AJ_MarshalReplyMsg
function and an example can be found from https://git.allseenalliance.org/cgit/core/ajtcl.git/tree/samples/basic/basic_service.c#n84.In terms of the API how this is exposed, alternatives include at least extending the
addListener
interface for returning values from the callbacks or defining a new interface likeaddMethodImplementation
that has mechanism to handle returns.See the comment at #26 (comment) for background information.
The text was updated successfully, but these errors were encountered: