# melf

> (A)Synchronous remote procedure calls

Latest version **2.2.13** (published 2019-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install melf
pnpm add melf
yarn add melf
bun add melf
```

## 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 | 2.2.13 |
| Published | 2019-05-20 |
| First published | 2017-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Laurent Christophe |
| Maintainers | lachrist |
| Keywords | JavaScript, Remote Procedure Call, Processes, Communication, Synchronous, Asynchronous |

## Links

- npm: https://www.npmjs.com/package/melf
- Repository: https://github.com/lachrist/melf
- Homepage: http://github.com/lachrist/melf
- Issues: https://github.com/lachrist/melf/issues
- npm.io page: https://npm.io/package/melf

## Dependencies (1)

- [antena](https://npm.io/package/antena.md) 4.0.9

## Recent versions

- 2.2.13 (latest) — 2019-05-20
- 2.2.12 — 2019-03-15
- 2.2.11 — 2019-03-15
- 2.2.10 — 2019-03-14
- 2.2.9 — 2019-03-12
- 2.2.8 — 2019-03-11
- 2.2.7 — 2019-03-11
- 2.2.6 — 2019-03-10
- 2.2.5 — 2019-03-10
- 2.2.4 — 2019-03-10
- 2.2.3 — 2019-03-10
- 2.2.1 — 2019-03-08
- 2.2.0 — 2019-03-07
- 2.1.1 — 2019-03-04
- 2.1.0 — 2019-03-04
- … 32 more at https://npm.io/package/melf/versions

## README

# Melf <img src="melf.png" align="right" alt="melf-logo" title="Melf's Minute Meteors"/>

[npm module](https://www.npmjs.com/package/melf) to perform (a)synchronous remote procedure calls for JavaScript processes.
Synchronous remote procedure calls can be interleaved (only) by locally declared remote procedures without deadlocks.

## Client API

### `require("melf")(address, alias, callback)`

* `address :: string | object | melf.Receptor`
* `alias :: string`
* `callback(error, melf)`
  * `error :: Error | null`
  * `melf :: melf.Melf`

### `output = melf.rpcall(recipient, rpname, input)`

* `recipient :: string`
* `rpname :: string`
* `input :: JSON`
* `output :: JSON`

### `melf.rpcall(recipient, rpname, input, (error, output) => {...})`

* `recipient :: string`
* `rpname :: string`
* `input :: JSON`
* `error :: Error | null`
* `output :: JSON`

### `melf.rprocedures[rpname] = (origin, input, callback) => {...}`

* `rpname :: string`
* `origin :: string`
* `input :: JSON`
* `callback(error, output)`
  * `error :: Error | null`
  * `output :: JSON`

### `melf.destroy()`

### `melf.terminate()`

### `melf.onterminate = () => { ... }`

## Server API

### `distributor = require("melf/distributor")(logger)`

* `logger(origin, recipient, meteor) | undefined | boolean`
  * `origin :: string` 
  * `recipient :: string`
  * `meteor :: string`
* `distributor :: melf.Distributor`

### `listener = orchestrator.ConnectionListener()`

* `listener(net.Socket)`

### `middleware = distributor.RequestMiddleware(splitter)`

* `splitter :: string | undefined`
* `handled = middleware(request, response, next)`
  * `request :: http.Request`
  * `response :: http.Response`
  * `next()`
  * `handled :: boolean`

### `middleware = distributor.UpgradeMiddleware(splitter)`

* `splitter :: string | undefined`
* `handled = middleware(request, socket, head, next)`
  * `request :: http.Request`
  * `socket :: net.Socket`
  * `head :: Buffer`
  * `next()`
  * `handled :: boolean`

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