我正在尝试使用 webRTC 和 WebSockets 来开发视频聊天应用程序作为信号。我的问题是我不知道创建 RTCPeerConnection 并通过 webSocket(至少在本地)连接两个对等点(2 个浏览器)的过程是什么。
我知道如何通过 WebSockets 与客户端通信,但不知道如何使用 RTCPeerConnection API,你知道任何教程一步一步解释这个过程吗?(提供 SDP,答案,ICE,...),另一方面,看起来如何通过 RTCPeerConnection 管理这些客户端的服务器代码?
这是我用于服务器的 Node.js 代码
"use strict";
// Optional. You will see this name in eg. 'ps' or 'top' command
process.title = 'node-webrtc';
// Port where we'll run the websocket server
var webSocketsServerPort = 1337;
// websocket and http servers
var webSocketServer = require('websocket').server;
var http = require('http');
/* ---------------------------------
GLOBAL VARIABLES
----------------------------------*/
// latest 100 messages
//var history = [ ];
// list of …Run Code Online (Sandbox Code Playgroud)