# gracenode-udp

> UDP module for gracenode framework

Latest version **0.1.1** (published 2014-05-23) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-05-23 |
| First published | 2014-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nobuyori Takahashi |
| Maintainers | voltrue2 |
| Keywords | gracenode, framework, UDP, module |

## Links

- npm: https://www.npmjs.com/package/gracenode-udp
- Repository: https://github.com/voltrue2/gracenode-udp
- Issues: https://github.com/voltrue2/gracenode-udp/issues
- npm.io page: https://npm.io/package/gracenode-udp

## Dependencies (1)

- [async](https://npm.io/package/async.md) 0.8.0

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads
- [@modern-js/plugin-swc](https://npm.io/package/@modern-js/plugin-swc.md) — 3.4K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2014-05-23

## README

# gracenode-udp Module

UDP Module for gracenode framework.

This is designed to function within gracenode framework.

## How to include it in my project

To add this package as your gracenode module, add the following to your package.json:

```
"dependencies": {
	"gracenode": "",
	"gracenode-udp": ""
}
```

To use this module in your application, add the following to your gracenode bootstrap code:

```
var gracenode = require('gracenode');
// this tells gracenode to load the module
gracenode.use('gracenode-udp');
```

To access the module:

```
// the prefix gracenode- will be removed automatically
gracenode.udp
```

Access
<pre>
gracenode.udp
</pre>

Configurations
```javascript
"modules": {
	"udp": {
		"servers": [
			{ name: "unique name for server", "host": "host name or IP", "port": port number }[...]
		],
		"requests": {
			"unique request name": { "host": "host name or IP", "port": port number }
		}
	}
}
```

#####API: startServers

<pre>
void startServers(Function callback)
</pre>
> Starts all UDP servers and calls the callback function when all the servers are up

#####API: getServerByName

<pre>
Object getServerByName(String serverName)
</pre>
> Returns a server object by a server name defined in the configurations
>> *startServer* MUST be called before invoking this function

Example
```javascript
var server = gracenode.udp.getServerByName('server');

// handle UDP message requests
server.on('message', function (messageBuffer, requestObj) {
	// do something
});

// handle error
server.on('error', function (error) {
	// handle error
});
```

#####API: send

<pre>
void send(String requestName, Mixed message, Object options, Function callback)
</pre>
> Sends a UDP packet message to destination named in the configurations
>> The callback returns error as the first argument and bytes sent as the second argument

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