# connections

> Keeps track of connections to an http server and provides a way to close connections

Latest version **1.4.2** (published 2016-02-20) · BSD-2-Clause license · 0 weekly downloads

## Install

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

## 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 | 1.4.2 |
| Published | 2016-02-20 |
| First published | 2013-12-07 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | max ogden |
| Maintainers | mafintosh, maxogden |

## Links

- npm: https://www.npmjs.com/package/connections
- Repository: https://github.com/maxogden/connections
- Issues: https://github.com/maxogden/connections/issues
- npm.io page: https://npm.io/package/connections

## Recent versions

- 1.4.2 (latest) — 2016-02-20
- 1.4.1 — 2016-02-20
- 1.4.0 — 2016-02-08
- 1.3.0 — 2016-02-08
- 1.2.0 — 2016-02-08
- 1.1.0 — 2016-02-08
- 1.0.0 — 2014-04-18
- 0.1.0 — 2014-04-18
- 0.0.1 — 2013-12-07

## README

# connections

Keeps track of connections to an http or tcp server (or any other server object with the same api) and provides a way to close connections

By default, `require('http').createServer` provides no mechanism for tracking client connections and/or closing client connections

[![NPM](https://nodei.co/npm/connections.png)](https://nodei.co/npm/connections/)

## usage

```
var connections = require('connections')(serverInstance)
```

You can also pass an array of server instances

`connections` has `.sockets` and `.destroy`

### connections.on('idle', function() {})

called whenever all active connections have closed

### connections.on('close', function(socket) {})

called whenever a socket closes

### connections.on('connection', function (socket) {})

forwarded event from the server or servers

### connections.sockets

an array of open sockets (http clients)

### connections.destroy()

destroys/closes all active connections (calls .destroy() on each socket)

### connections.add(socket)

manually add a socket to the connection list

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