# myps.client

> ## Example:

Latest version **1.0.7** (published 2018-10-22) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install myps.client
pnpm add myps.client
yarn add myps.client
bun add myps.client
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2018-10-22 |
| First published | 2018-08-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | shabunin |

## Links

- npm: https://www.npmjs.com/package/myps.client
- npm.io page: https://npm.io/package/myps.client

## Recent versions

- 1.0.7 (latest) — 2018-10-22
- 1.0.6 — 2018-10-09
- 1.0.5 — 2018-10-03
- 1.0.4 — 2018-09-12
- 1.0.0 — 2018-08-30

## README

# myps.client - client for my simple pub/sub implementation

## Example:

```js
let MyPubSub = require("myps.client");

let myPubSub = MyPubSub();

myPubSub.on("message", (topic, message, connection_id) => {
  console.log(`Message "${message}" from ${connection_id} to topic ${topic}`);
});

myPubSub.on("error", e => {
  console.log("aaargh", e.message);
  setTimeout(myPubSub.reconnect, 5000);
});

myPubSub.on("end", _ => {
  console.log("this is the end. the only end, my friend");
  setTimeout(myPubSub.reconnect, 5000);
});

myPubSub.on("connect", async connection_id => {
  console.log(`Connected as ${connection_id}`);
  try {
    await myPubSub.subscribe("friend");
    await myPubSub.publish("friend", "hello, drug");
    await myPubSub.publish("drug", "friend");
    await myPubSub.unsubscribe("friend");
    await myPubSub.unsubscribe("drug");
  } catch (e) {
    console.log("Errr::::", e.message);
  }
});
```

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