Socket
Socket
Sign inDemoInstall

sync-rpc

Package Overview
Dependencies
1
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sync-rpc

Run asynchronous commands synchronously by putting them in a separate process


Version published
Weekly downloads
979K
decreased by-1.03%
Maintainers
1
Install size
19.3 kB
Created
Weekly downloads
 

Readme

Source

sync-rpc

Run asynchronous commands synchronously by putting them in a separate process

Build Status Dependency Status NPM version

Installation

npm install sync-rpc --save

Usage

worker.js

function init(connection) {
  // you can setup any connections you need here
  return function (message) {
    // Note how even though we return a promise, the resulting rpc client will be synchronous
    return Promise.resolve('sent ' + message + ' to ' + connection);
  }
}
module.exports = init;
const assert = require('assert');
const rpc = require('sync-rpc');

const client = rpc(__dirname + '/../test-worker.js', 'My Server');

const result = client('My Message');

assert(result === 'sent My Message to My Server');

License

MIT

FAQs

Last updated on 24 Jul 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc