# dgram-browserify

> dgram module for the browser thru a proxy based on socket.io

Latest version **0.0.13** (published 2012-06-10) · 0 weekly downloads

## Install

```sh
npm install dgram-browserify
pnpm add dgram-browserify
yarn add dgram-browserify
bun add dgram-browserify
```

## 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.13 |
| Published | 2012-06-10 |
| First published | 2012-06-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.4.12 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | alexstrat |
| Maintainers | alexstrat |

## Links

- npm: https://www.npmjs.com/package/dgram-browserify
- Repository: https://github.com/alexstrat/dgram-browserify
- npm.io page: https://npm.io/package/dgram-browserify

## Dependencies (1)

- [simudp](https://npm.io/package/simudp.md) ~0.0

## Recent versions

- 0.0.13 (latest) — 2012-06-10
- 0.0.12 — 2012-06-10
- 0.0.11 — 2012-06-01

## README

Kind of udp support for the browser : replace the [dgram](http://nodejs.org/api/dgram.html) module. Behind the scene, a [socket.io](http://socket.io)/udp proxy makes this possible.

*dgram-browserify* is a wrapper around [simudp](https://github.com/alexstrat/simudp) for automatic [browserify](https://github.com/substack/node-browserify) support.

**Be careful**, for the [moment](https://github.com/substack/node-browserify/pull/143), the main *browserify* version provides a broken implementation of *Buffer*. That's why [this](https://github.com/toots/node-browserify) version should be used..

### Installation

```bash
$ npm install dgram-browserify
```

### Use

**Server-side**, the proxy server should be launched :

```js
var server = require('http').createServer();

require('dgram-browserify').listen(server);

server.listen(8080);
```

*Note :* [see](https://github.com/alexstrat/simudp/blob/master/lib/server.js#L29-43) *listen* options

**Browser-side** with *browserify* :

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

//be sure Buffer is present
var Buffer = require('buffer').Buffer;

var socket = dgram.createSocket('udp4');

var hello = new Buffer('hello');
socket.send(hello, 0, hello.length, 3000, 'anywhere.com');

socket.on('message', function(buf, rinfo) {
  //...
});

//you've understood, it's dgram for the browser...
```

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