Calling server side functions from client and getting back result

Server side

Client side

client.ready(function (serverProxy) {
//the onReady event is triggered when the remote side finishes
//executing the called function.
//returned value is stored in result argument
serverProxy.add(10, 5).onReady(function(result) {
console.log('got result from server, 10+5=', result);
});
});

Calling client side functions from server and getting the result back

in this example, client will call foo() function on the server, then the server
will call bar() function on the client sideimportant client side functions need to be allowed first in the server side when creating the server object