# rpcsocketlib

> ## install

Latest version **0.0.3** (published 2021-01-27) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2021-01-27 |
| First published | 2021-01-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | certug |

## Links

- npm: https://www.npmjs.com/package/rpcsocketlib
- Repository: https://github.com/celalertug/rpcsocket
- Homepage: https://github.com/celalertug/rpcsocket#readme
- Issues: https://github.com/celalertug/rpcsocket/issues
- npm.io page: https://npm.io/package/rpcsocketlib

## Dependencies (4)

- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [express](https://npm.io/package/express.md) ^4.17.1
- [socket.io](https://npm.io/package/socket.io.md) ^3.1.0
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^3.1.0

## Recent versions

- 0.0.3 (latest) — 2021-01-27
- 0.0.2 — 2021-01-26
- 0.0.1 — 2021-01-26

## README

# rpcsocketlib

## install

```bash
yarn add rpcsocketlib
```

### server.js

```js

const { socketServer } = require('rpcsocketlib');

(async () => {
  await socketServer(4001);
})();

```

### provider.js

```js

const { socketConsume } = require('rpcsocketlib');

socketConsume('http://localhost:4001', 'test-channel', async (body) => {
  console.log(body);
  return body;
});

```

### consumer.js

```js

const { socketRequest } = require('rpcsocketlib');

(async () => {
  const res = await socketRequest('http://localhost:4001', 'test-channel', { message: 'surprise motherfucker' });
  console.log(res);
})();

```


## usage

socketRequest (uri, channel, body, config)

- uri : socket server url, ex : http://localhost:4001
- channel : target client channel
- body : data, type : object
- config : options [timeout : int , noReply : bool]


socketConsume (uri, channel, cb)

- uri : socket server url, ex : http://localhost:4001
- channel : incoming data channel
- cb : callback, ex : cb(body) {}

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