Skip to content

kolegm/racer-rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@deprecated package

I recommend to use racer-model-rpc instead of the current package


racer-rpc

Racer/Derby plugin for enabling RPC

How to use

After adding the plugin:

racer.use(require('racer-rpc'));

Use it below API:

API

On server:

// With callback
var backend = racer.createBackend(...);
backend.rpc.on('rpc-with-callback', function (arg1, arg2, cb) {
  arg1 === 'arg1' // true
  arg2 === 'arg2' // true
  cb(null, 'arg3', 'arg4');
});

// Without callback
backend.rpc.on('rpc-without-callback', function (arg1, arg2) {
  arg1 === 'arg1' // true
  arg2 === 'arg2' // true
});

On client:

// With callback
model.call('rpc-with-callback', 'arg1', 'arg2', function (err, arg3, arg4) {
  arg3 === 'arg3' // true
  arg4 === 'arg4' // true
});

// Without callback
model.call('rpc-withour-callback', 'arg1', 'arg2');

Releases

No releases published

Packages

No packages published