我正在开发一个基于 node.js 和 Kurento 的 WebRTC 应用程序,我想使用数据通道实现聊天。
我已经看过浏览器的 javascript 版本,我想将它集成到一对一的 node.js 示例中。
我做了什么
1.- 我创建了两个具有数据通道功能的 WebRTCEndpoints,如下所示:pipeline.create('WebRtcEndpoint', {useDataChannels: true}, function(error, calleeWebRtcEndpoint) {...}
2.- 然后我创建了<textarea>
一个<button>
用于发送消息和一个<div>
用于查看消息的。
所以我的问题是,当我在客户端创建数据通道时,我必须放置哪些服务器? 此片段来自浏览器 javascript 数据通道教程,但在文件开头我们可以清楚地看到 ICE 服务器在连接创建中忽略。另外,我不知道您如何在 node.js 教程中管理它们,所以我在这里有点迷失。
peerConnection = new RTCPeerConnection(servers, configuration);
channel = peerConnection.createDataChannel(getChannelName(), dataConstraints);
channel.onopen = onSendChannelStateChange;
channel.onclose = onSendChannelStateChange;
channel.onmessage = onMessage;`
谢谢您的帮助。