为WebRTC应用程序实现我们自己的STUN/TURN服务器 [英] Implementing our own STUN/TURN server for WebRTC Application

查看:351
本文介绍了为WebRTC应用程序实现我们自己的STUN/TURN服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个webrtc应用程序,并且必须实现以下TURN服务器.

I am working on a webrtc application and have to implement following TURN server.

https://code.google.com/p/rfc5766-turn-server/

我正在关注本教程.

http://www.dialogic.com/den/developer_forums/f/71/t/10238.aspx

它说要在创建RTCPeerConnection的javascript代码中引用以下TURN服务器.

and it says to reference the TURN server as follows, in javascript code where RTCPeerConnection is created.

var pc_config = {"iceServers": [{"url": "stun:stun.l.google.com:19302"},
  {"url":"turn:<turn_server_ip_address>", "username":"my_username", "credential":"my_password"}]};

pc_new = new webkitRTCPeerConnection(pc_config);

我有点困惑,为什么我们要引用Google的公共STUN服务器.我以为RFC5766 TURN服务器内部有STUN.

I am little confused, why are we referencing to Google's public STUN server. I thought RFC5766 TURN server has STUN inside it.

仅RFC5766是TURN服务器吗?而不是STUN服务器?我们不能使用Google提供的服务器来实现自己的STUN服务器吗?

Is RFC5766 only TURN server? and not STUN server? Can't we implement our own STUN server rather using one provided by Google?

很抱歉这个幼稚的问题.我是WebRTC的新手.

Sorry for such naive question. I am new to WebRTC.

谢谢.

推荐答案

TURN是STUN的扩展,因此TURN服务器也具有STUN功能.

TURN it's an extension of STUN, so TURN server has also STUN features.

https://code.google.com/p/rfc5766-turn-server/也可用作STUN,因此您可以尝试编写如下内容:

https://code.google.com/p/rfc5766-turn-server/ works also as a STUN, so you can try to write something like this:

var pc_config = {"iceServers": [{"url":"turn:my_username@<turn_server_ip_address>", "credential":"my_password"}]};

pc_new = new webkitRTCPeerConnection(pc_config);

这篇关于为WebRTC应用程序实现我们自己的STUN/TURN服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆