Code Monkey home page Code Monkey logo

turn-js's Introduction

CircleCI npm

Turn-JS

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

Features

  • implements (most of) the features specified in RFC 5766
  • 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

turn-js's People

Contributors

nicojanssens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

turn-js's Issues

Magic cookie field has incorrect value

I'm trying to send file via turn server, and got this error:

/home/mihael/Projects/cloud-compute/node_modules/turn-js/node_modules/stun-js/src/packet.js:79
throw new Error(incorrectMagicCookieError)
^

Error: magic cookie field has incorrect value
at Function.Packet.decode (/home/mihael/Projects/cloud-compute/node_modules/turn-js/node_modules/stun-js/src/packet.js:79:11)
at TcpWrapper._onMessage (/home/mihael/Projects/cloud-compute/node_modules/turn-js/node_modules/stun-js/src/stun_comm.js:94:29)
at Socket. (/home/mihael/Projects/cloud-compute/node_modules/stun-js/src/transports/tcp.js:24:10)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)

Can you help me with it ?

MOAR DOCS

Hey! Nice work! I'd love to incorporate TURN as a transport middleware for [kad](github.com/gordon writescode/kad). Any ideas when you might have some documentation to help?

For now I'll use the source!

Unhandled exception when I try to close connection.

Hello, when I try to close turn connection I got an Unhandled exception:

Error: client error: Error: read ECONNRESET
at Socket. (/home/mihael/Projects/cloud-compute/node_modules/turn-js/node_modules/stun-js/src/stun_comm.js:146:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1253:8)
at doNTCallback2 (node.js:450:9)
at process._tickCallback (node.js:364:17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.