# origami2-plugin-io

> Origami2 plugin io

Latest version **0.5.12** (published 2016-10-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install origami2-plugin-io
pnpm add origami2-plugin-io
yarn add origami2-plugin-io
bun add origami2-plugin-io
```

## 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.5.12 |
| Published | 2016-10-13 |
| First published | 2016-08-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Diego Pérez |
| Maintainers | eazel7 |

## Links

- npm: https://www.npmjs.com/package/origami2-plugin-io
- npm.io page: https://npm.io/package/origami2-plugin-io

## Dependencies (2)

- [origami2](https://npm.io/package/origami2.md) ^0.5.12
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^1.4.8

## Recent versions

- 0.5.12 (latest) — 2016-10-13
- 0.5.10 — 2016-10-11
- 0.5.8 — 2016-09-20
- 0.5.1 — 2016-08-30
- 0.5.0 — 2016-08-30
- 0.4.4 — 2016-08-30
- 0.4.3 — 2016-08-30
- 0.4.2 — 2016-08-30
- 0.4.1 — 2016-08-30
- 0.4.0 — 2016-08-29

## README

# Origami 2 plugin socket.io helper

## constructor

Params:

- `api` **required**: Plugin constructor function.
- `privateKey` **required**: Plugin private key.
- `dependenciesMap` **optional**: An object containing string keys and string values. For example:

```
{
  "constructorParameterName": "OtherPluginName"
}
```

  A client object will be created, that client will use the same context as the plugin invoked method.
  Each key like `constructorParameterName` will be mapped to an API proxy.

- `locals` **optional**: An object containing string keys and string values. For example:

```
{
  "param1": 1,
  "param2": "another",
  "db": myDb
}
```
- `events` **optional**:

  Each key like `param1` will be set as the value on the constructor of the same name.
  
> An additional constructor will be passed: `emit` which receives one parameter and broadcast the event to the stack.

## .connect

Returns: a Promise to be resolved once connected
Params:
- `url` **required**: the URL to connect using a [socket.io client](http://socket.io).

> It is expected the other end to be using the [stack socket.io helper](https://gitlab.com/origami2/stack-io)

## .listenSocket

Returns: a Promise to be resolved once connected
Params:
- `socket` **required**: a socket to connect to. Might be an event emitter or a [socket.io socket object](http://socket.io).

> It is expected the other end to be using the [stack socket.io helper](https://gitlab.com/origami2/stack-io)

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