Socket
Book a DemoInstallSign in
Socket

loopback-connector-jsonrpc

Package Overview
Dependencies
Maintainers
20
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loopback-connector-jsonrpc

Loopback JSONRPC Connector

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
20
Created
Source

LoopBack JSON-RPC Connector

The LoopBack JSON-RPC Connector allows you to call JSON-RPC services from LoopBack models. It uses jayson as the client library.

Usage


    var ds = loopback.createDataSource({
        connector: require("loopback-connector-jsonrpc"),
        debug: false,
        baseURL: 'http://localhost:3000',
        operations: ['add', 'subtract']});

    var model = ds.createModel('dummy');

    model.add(1, 2, function(err, data) {
        console.log(err, data);
    });

Options to configure the connector:

  • url: Base URL to the json-rpc server
  • operations: An array of operation names

You can also configure the baseURL as follows.

{
    host: 'localhost',
    port: 3000
}

Other properties will be passed to jayson.

  • reviver: Function to use as a JSON reviver
  • replacer: Function to use as a JSON replacer
  • generator: Function to generate request ids with. If omitted, Jayson will just generate a "random" number that is RFC4122 compliant and looks similar to this: 3d4be346-b5bb-4e28-bc4a-0b721d4f9ef9
  • version: Can be either 1 or 2 depending on which specification should be followed in communicating with the server. Defaults to 2 for JSON-RPC 2.0
  • encoding: String that determines the encoding to use and defaults to utf8

License

MIT

FAQs

Package last updated on 10 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts