# turn-js

> TURN (Traversal Using Relay NAT) library written entirely in JavaScript

Latest version **0.7.0** (published 2024-11-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install turn-js
pnpm add turn-js
yarn add turn-js
bun add turn-js
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2024-11-13 |
| First published | 2015-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.9.0 |
| Dependencies | 8 |
| Unpacked size | 92.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Nico Janssens |
| Maintainers | nicoj |
| Keywords | nat, turn, udp |

## Links

- npm: https://www.npmjs.com/package/turn-js
- Repository: https://github.com/microminion/turn-js
- Homepage: https://github.com/microminion/turn-js#readme
- Issues: https://github.com/microminion/turn-js/issues
- npm.io page: https://npm.io/package/turn-js

## Dependencies (8)

- [q](https://npm.io/package/q.md) ^1.4.1
- [merge](https://npm.io/package/merge.md) ^1.2.0
- [args-js](https://npm.io/package/args-js.md) ^0.10.12
- [stun-js](https://npm.io/package/stun-js.md) ^0.7.0
- [winston](https://npm.io/package/winston.md) ^2.3.1
- [winston-debug](https://npm.io/package/winston-debug.md) ^1.1.0
- [winston-browser](https://npm.io/package/winston-browser.md) ^1.0.0
- [winston-meta-wrapper](https://npm.io/package/winston-meta-wrapper.md) ^1.0.0

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 0.7.0 (latest) — 2024-11-13
- 0.5.4 — 2017-02-27
- 0.5.3 — 2017-02-12
- 0.5.2 — 2017-01-18
- 0.5.0 — 2017-01-10
- 0.4.4 — 2016-12-17
- 0.4.3 — 2016-12-14
- 0.4.2 — 2016-10-24
- 0.4.1 — 2016-10-24
- 0.3.17 — 2016-08-31
- 0.3.16 — 2016-08-12
- 0.3.15 — 2016-08-12
- 0.3.14 — 2016-08-11
- 0.3.13 — 2016-08-11
- 0.3.12 — 2016-08-11
- … 17 more at https://npm.io/package/turn-js/versions

## README

[![CircleCI](https://circleci.com/gh/MicroMinion/turn-js.svg?style=shield)](https://circleci.com/gh/MicroMinion/turn-js)
[![npm](https://img.shields.io/npm/v/turn-js.svg)](https://npmjs.org/package/turn-js)

# Turn-JS
#### TURN (Traversal Using Relay NAT) library written entirely in JavaScript.

## Features

- implements (most of) the features specified in [RFC 5766](https://tools.ietf.org/html/rfc5766)
- supports TCP and UDP communication
- offers callback and promise based API
- can be browserified (to be used in chrome apps)

## Install

```
npm install turn-js
```

## Usage

### Callbacks

### Promises

## API

### `myClient = turn(serverAddr, serverPort, user, pwd, transport)`

### `myClient.allocate(function(address) {}, function(error) {})`

### `myClient.allocateP()`

### `myClient.createPermission(address, function() {}, function(error) {})`

### `myClient.createPermission(address)`

### `myClient.bindChannel(address, port, channel, lifetime, function() {}, function(error) {})`

### `myClient.bindChannelP(address, port, channel)`

### `myClient.refresh(lifetime, function() {}, function(error) {})`

### `myClient.refreshP(lifetime)`   

### `myClient.close(function() {}, function(error) {})`

### `myClient.sendToRelay(bytes, address, port, function() {}, function(error))`

### `myClient.sendToRelayP(bytes, address, port)`

### `myClient.sendToChannel(bytes, channel, function() {}, function(error) {})`

### `myClient.sendToChannelP(bytes, channel)`


## Events

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