# iec104-protocol

> 104 protocol common toolkit

Latest version **1.2.0** (published 2023-10-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install iec104-protocol
pnpm add iec104-protocol
yarn add iec104-protocol
bun add iec104-protocol
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2023-10-09 |
| First published | 2023-09-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.13 |
| Dependencies | 0 |
| Unpacked size | 498.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | wukz |
| Maintainers | wukezeng |

## Links

- npm: https://www.npmjs.com/package/iec104-protocol
- Repository: https://github.com/wukz959/iec104-protocol
- Homepage: https://github.com/wukz959/iec104-protocol.git
- Issues: https://github.com/wukz959/iec104-protocol/issues
- npm.io page: https://npm.io/package/iec104-protocol

## Recent versions

- 1.2.0 (latest) — 2023-10-09
- 1.1.1 — 2023-09-12
- 1.1.0 — 2023-09-04
- 1.0.3 — 2023-09-04
- 1.0.2 — 2023-09-04
- 1.0.1 — 2023-09-04
- 1.0.0 — 2023-09-04

## README

# IEC104-PROTOCOL

Only need to set a simple IP and PORT to achieve fast access and data analysis of 104 protocol

## Quick Start

```js
$ npm i iec104-protocol
```

## Examples

For the connection you need, you only need to set the ip and port to achieve fast data collection

```tsx
import {Protocol} from 'iec104-protocol'

/* 
Before starting the program, you need to set the host IP address on the host. The program does not provide the host IP address setting by default
*/
const conn1 = new Protocol('198.123.0.1', 2404, (data) => {
    for (const tmp of data) {
        console.log(tmp)
    }
})
conn1.connect()

const conn2 = new Protocol('198.123.0.2', 2404, (data) => {

    for (const tmp of data) {
        console.log(tmp)
    }
})
conn2.connect()

```

## Options

### autoReconnect 

By setting the autoReconnect option, you can automatically reconnect when the connection is disconnected

```ts
import { Protocol, Option } from 'iec104-protocol'
/*
If the connection is disconnected, the reconnection is automatically attempted every 10,000 ms by default. If the reconnection fails for 10 times, the reconnection interval changes to 60,000ms
*/
const option:Option = { autoReconnect: true}
const conn = new Protocol('198.123.0.1', 2404, (data) => {
    for (const tmp of data) {
        console.log(tmp)
    }
}, option)
conn.connect()

```

### quiet	

The code will output some debugging information by default, you can choose to disable it by setting the quiet option to true

```ts
import { Protocol, Option } from 'iec104-protocol'

const option:Option = { quiet: true }
const conn = new Protocol('198.123.0.1', 2404, (data) => {
    for (const tmp of data) {
        console.log(tmp)
    }
}, option)

conn.connect()

```

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