如果我想要实时视频流旁边的实时聊天功能,我应该将webrtc与socket.io一起使用?
我要做的是创建一个简单的虚拟课堂项目,例如Adobe Connect,但显然更简单,使用Flutter
和nodejs
,我需要以下选项:
- Real-时间视频或仅语音流式
- 实时聊天框
- 屏幕共享能力
- 文件共享能力(例如PDF或PowerPoint或其他文本/DOC文件)
- 白板,
我迄今为止搜索时,我发现似乎Webrtc
适用于视频/语音流以及屏幕共享。
还使用socket.io
的大多数LiveChat项目。
我的主要问题是要知道我可以仅使用webrtc
进行实时视频/语音流以及实时聊天吗?这是一个好主意,还是最好将socket.io
和webrtc
组合在一起?
此外,我想知道我可以将每个库中的每个库用于文件共享目的吗?
What I am trying to do is to create a simple virtual classroom project like Adobe connect, but obviously simpler, using Flutter
and NodeJS
, and I need the following options:
- Real-time video or only voice streaming
- Live chat box
- Screen sharing ability
- File sharing ability(Like PDF or PowerPoint or other text/doc files)
- Whiteboard
As I searched so far I found that it seems WebRTC
works for video/voice streaming and also screen sharing as well.
Also most of the livechat projects using Socket.IO
.
My main question here is to know can I use only WebRTC
for both real-time video/voice streaming and also live chat as well? Is it a good idea or it's better to combine Socket.IO
and WebRTC
together?
Furthermore I want to know can I use each of those libraries for File-Sharing purposes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
WebRTC为您提供较低的延迟和大量功能,用于开箱即用。因此,对于视频/音频通话和屏幕共享,这绝对是一个更好的选择。
此外,还有一个选择使用P2P通信的选项,该通信可减少更多的延迟,并为您在服务器端节省资源。虽然,如果您打算支持许多参与者,它看起来不太有益 - 如果您总共拥有
n
用户,则需要为每个用户维护n -1
连接。对于实时聊天,白板和文件共享,性能没有很大的差异。
需要考虑的事情:
,还有一个
一个很好的例子,有一个OpenSource项目 peercalls ,它通过使用相同的连接实现聊天和文件传输,进行会议。
Websockets也可以用于文件传输,请查看此库。
WebRTC gives you lower latency and a lot of functionality for conferencing out of the box. So for video/audio calls and screen sharing this is definitely a better choice.
Also, there's an option to use p2p communication which reduces latency even more and saves you resources on the server-side. Though if you intend to support many participants it looks less beneficial - you will need to maintain
n-1
connections for each user if you haven
users in total.For live chat, whiteboard and file sharing there would be no big difference in terms of performance.
Things to consider:
Yes you can, there's a RTCDataChannel interface for exchanging arbitrary data. It can be used for live chat / whiteboard / file transfer.
As a good example, there's an opensource project peercalls, that implements chat and file transfer via WebRTC through the same connection that is used for conferencing.
Websockets can be used for file transfer as well, check out this library.
使用WebRTC要求信号服务器和信令通常使用WebSocket实施,请检查此MDN文章信号和视频通话,
并且使用WebSocket,您也可以实现LiveChat,因此它不是一个或情况,但两者都经常。
Using WebRTC requires signaling server and signaling is often implemented using websocket, check this mdn article Signaling and video calling
And with websocket you can implement livechat too, so it is not an either or situation but both quite often.
对于实时的视频流wit Webrtc,您需要以下元素:
如您所见可以使用 socket.io ,但仅用于发射信号和iCecandidate。
For real-time video streaming wit WebRTC you need this elements:
As you see in this case you can use Socket.io but only for Emit Signals and ICECandidate.