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

Vyacheslav picture Vyacheslav · Nov 29, 2017 · Viewed 8.2k times · Source

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?

Answer

Alexandre Tiertant picture Alexandre Tiertant · May 16, 2018

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();