# @lsdsoftware/connection-manager

> Maintaining connection state is a royal pain in the behind. This utility class takes a `connect()` method and: - Only call it to create a connection when needed - Automatically retry on failure - Automatically reconnect if the previous connection was clo

Latest version **1.0.0** (published 2022-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lsdsoftware/connection-manager
pnpm add @lsdsoftware/connection-manager
yarn add @lsdsoftware/connection-manager
bun add @lsdsoftware/connection-manager
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-07-31 |
| First published | 2022-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Hai Phan |
| Maintainers | ken107 |

## Links

- npm: https://www.npmjs.com/package/@lsdsoftware/connection-manager
- Repository: https://github.com/lsdsoftware/connection-manager
- Homepage: https://github.com/lsdsoftware/connection-manager#readme
- Issues: https://github.com/lsdsoftware/connection-manager/issues
- npm.io page: https://npm.io/package/@lsdsoftware/connection-manager

## Dependencies (1)

- [rxjs](https://npm.io/package/rxjs.md) ^7.5.6

## Recent versions

- 1.0.0 (latest) — 2022-07-31

## README

# Connection Manager

Maintaining connection state is a royal pain in the behind.  This utility class takes a `connect()` method and:
- Only call it to create a connection when needed
- Automatically retry on failure
- Automatically reconnect if the previous connection was closed
- Properly handle shutdown sequence


## Usage

```typescript
const conMgr = new ConnectionManager({
  async connect() {
    //...
    return connection
  },
  retryDelay: 10*1000
})

//wherever you need the connection
const connection = await conMgr.get()

//shutdown
conMgr.shutdown()
```

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