# conn

> 基于tcp的长连接通道

Latest version **0.0.4** (published 2014-02-18) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2014-02-18 |
| First published | 2014-01-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.6.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | 继风 |
| Maintainers | jifeng.zjd |

## Links

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

## Dependencies (1)

- [options-stream](https://npm.io/package/options-stream.md) *

## Recent versions

- 0.0.4 (latest) — 2014-02-18
- 0.0.3 — 2014-02-13
- 0.0.2 — 2014-02-12
- 0.0.1 — 2014-01-21

## README

conn
=========


基于tcp的长连接通道

## 特点
* 基于nodejs原生的tcp连接,客户端和服务端可以方便地向对方发送消息
* 轻服务端,重客户端(连接的心跳和重连接都是由客户端发起)



## 安装
```bash
npm install conn
```

## 使用

### 服务端

```js
var conn = require('conn');

var server = conn.createServer();
server.listen(1723);

server.on('data', function (data){
	console.log(data);
});

```

### 客户端

```js
var conn = require('conn')
var client = conn.createClient({
  routeInterval: 2000,
  port: 1723,
  host: '127.0.0.1'
});

client.send('hello world');//发送消息
client.close();//关闭
```

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