# node-zmq-rpc

> Rpc client built on persistent zmq connections.

Latest version **1.1.2** (published 2018-01-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-zmq-rpc
pnpm add node-zmq-rpc
yarn add node-zmq-rpc
bun add node-zmq-rpc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2018-01-14 |
| First published | 2017-12-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dbriggs |

## Links

- npm: https://www.npmjs.com/package/node-zmq-rpc
- npm.io page: https://npm.io/package/node-zmq-rpc

## Dependencies (1)

- [zmq](https://npm.io/package/zmq.md) 2.15.3

## Recent versions

- 1.1.2 (latest) — 2018-01-14
- 1.1.1 — 2018-01-03
- 1.1.0 — 2017-12-23
- 1.0.0 — 2017-12-21

## README

# zmq-rpc
Rpc client built on persistent zmq connections.

## Getting Started
```shell
npm install --save zmq-rpc
```

```javascript
const { Client, Server } = require('zmq-rpc');

const server = Server({
	getUser(req) {
		const { name } = req.body;
		// Do something to get user...
		const user = getUser(name);
		req.reply(200, user);
	},
});
server.bind(`tcp://0.0.0.0:3000`);


const client = Client({ heartbeatPeriod: 500, health: 3 });
client.connect(`tcp://127.0.0.1:3000`);

client.on('close', () => {
	console.log('Client closed');
});

client.call('getUser', { name: 'Dan' });
	.then((resp) => {
		console.log(resp.statusCode, resp.body);
	})
	.catch((err) => {
		console.error(err.statusCode, err.body);
	});


// Later on...
client.close();
```

---
_Source: https://npm.io/package/node-zmq-rpc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
