简体   繁体   中英

How to make a turn server on node.js for peer connection

I'm using a node.js server to send iceCandidates and connect two computers by peer connection (javascript). I want to use TURN-server as iceServer, but I don't have one, so I want to make TURN-server on my server. How is it possible?

you can use node-turn to write your own server or using it as a standalone server.

var Turn = require('node-turn');
var server = new Turn({
  // set options
  authMech: 'long-term',
  credentials: {
    username: "password"
  }
});
server.start();

Short answer: Install and use Coturn

Not sure what you mean by "I want to use TURN-server as iceServer", but if I understand correctly you want to implement your own TURN-server. Just install coturn and configure your clients to use it. This will be a lot easier than to implement your own solution.

Look at the examples to see how to configure it for your needs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM