# net-socket

> net.Socket that automatically reconnects

Latest version **1.1.0** (published 2016-11-28) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install net-socket
pnpm add net-socket
yarn add net-socket
bun add net-socket
```

## 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.1.0 |
| Published | 2016-11-28 |
| First published | 2015-03-07 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Vadim Demedes |
| Maintainers | vdemedes |
| Keywords | net, reconnect, net-reconnect, socket |

## Links

- npm: https://www.npmjs.com/package/net-socket
- Repository: https://github.com/vdemedes/net-socket
- Issues: https://github.com/vdemedes/net-socket/issues
- npm.io page: https://npm.io/package/net-socket

## Dependencies (1)

- [delegates](https://npm.io/package/delegates.md) ^0.1.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-11-28
- 1.0.0 — 2015-03-07

## README

# net-socket

net.Socket that automatically reconnects if a server goes down.
Maintains 100% compatibility with net.Socket.

### Installation

```
$ npm install net-socket --save
```

### Usage

For detailed usage, see Node.js documentation on net.Socket - https://nodejs.org/api/net.html#net_class_net_socket.

Quick example:

```javascript
var net = require('net-socket');

var socket = net.connect(7777, 'localhost');

socket.setEncoding('utf8');
socket.on('connect', function () {
	// connected
	
	socket.end('hey');
	socket.destroy();
});
```

**WARNING**: To prevent socket from reconnecting, use `.destroy()` method to completely close it.

### Tests

[![Circle CI](https://circleci.com/gh/vdemedes/net-socket.svg?style=svg)](https://circleci.com/gh/vdemedes/net-socket)

```
$ npm test
```

### License

WTFPL – Do What the Fuck You Want to Public License

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