# good-udp

> UDP broadcasting for Good process monitor

Latest version **4.1.0** (published 2017-09-06) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install good-udp
pnpm add good-udp
yarn add good-udp
bun add good-udp
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.1.0 |
| Published | 2017-09-06 |
| First published | 2014-11-18 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | vdeturckheim, lloydbenson, arb |

## Links

- npm: https://www.npmjs.com/package/good-udp
- Repository: https://github.com/hapijs/good-udp
- Homepage: https://github.com/hapijs/good-udp#readme
- Issues: https://github.com/hapijs/good-udp/issues
- npm.io page: https://npm.io/package/good-udp

## Dependencies (1)

- [fast-safe-stringify](https://npm.io/package/fast-safe-stringify.md) 1.2.0

## Recent versions

- 4.1.0 (latest) — 2017-09-06
- 4.0.0 — 2016-06-25
- 3.0.0 — 2015-04-07
- 2.1.0 — 2015-01-11
- 2.0.0 — 2014-12-05
- 1.0.1 — 2014-11-21
- 1.0.0 — 2014-11-18

## README

# good-udp

Udp broadcasting for Good process monitor

The versions 4 of this module can be used with Good 7.

For use with previous versions of Good, please refer to [older versions](https://github.com/hapijs/good-udp/releases).

[![Build Status](https://travis-ci.org/hapijs/good-udp.svg?branch=master)](https://travis-ci.org/hapijs/good-udp) ![Current Version](https://img.shields.io/npm/v/good-udp.svg)

Lead Maintainer: [Vladimir de Turckheim](https://github.com/vdeturckheim)

## Usage

`good-udp` is a write stream use to send event to remote endpoints in batches. It makes a request with a JSON payload to the supplied `endpoint`. It will make a final request to the endpoint to flush the rest of the data on "finish".

### Note
`good-udp` will never close the udp client.

## Good Udp
### GoodUdp (endpoint, config)

creates a new GoodUdp object with the following arguments
- `endpoint` - full path to remote server to transmit logs.
- `config` - configuration object
	- `[threshold]` - number of events to hold before transmission. Defaults to `20`. Set to `0` to have every event start transmission instantly. It is strongly suggested to have a set threshold to make data transmission more efficient.
	- `[udpType]` - a string with the type of udp you want to use. Valid options are udp4 or udp6. Defaults to `'udp4'`.

When `stream` emits an "end" event, `goodudp` will transmit any events remaining it it's internal buffer to attempt to prevent data loss.

### Schema
Each request will match the following schema. Every event will be wrapped inside the `events` key and grouped by the event type and ordered by the timestamp. The payload that is sent to the `endpoint` has the following schema:

```json
{
  "host":"servername.home",
  "schema":"good-upd",
  "timeStamp":1412710565121,
  "events":[
      {
        "event":"request",
        "timestamp":1413464014739,
        ...
      },
      {
        "event":"request",
        "timestamp":1414221317758,
        ...
      },
      {
        "event":"request",
        "timestamp":1415088216608,
        ...
      }
      {
        "event":"log",
        "timestamp":1415180913160,
        ...
      },
      {
        "event":"log",
        "timestamp":1422493874390,
        ...
      }
  ]
}
```

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