(评论)
(comments)
原始链接: https://news.ycombinator.com/item?id=43654813
一篇Hacker News帖子讨论了WebRTC,起因是资源“WebRTC for the Curious”。评论者们强调了WebRTC的潜力,特别是数据通道可以实现具有可靠性控制的“网络上的UDP”。用户valorzard惋惜其生态系统不如QUIC发达,尽管它对基于网页的多人游戏非常有用。
资源作者Sean-Der强调了WebRTC的应用范围远不止网页浏览器,包括远程控制、安全和机器人技术。其他人指出WebRTC实现的复杂性和样板代码,通常需要TURN服务器进行NAT穿越,这可能会抵消P2P的优势。
SDP(会话描述协议)被认为是问题的关键来源,并提到了像Pion的SDP解释器这样的解决方案。用户讨论了各种语言(Go、Rust、TypeScript、C++等)的实现。一些人争论WebRTC是否能够通过ICE和STUN绕过公司防火墙,从而创建标准HTTP连接无法建立的NAT映射。还有一个项目使用WebRTC和WebAssembly构建了一个分布式SQLite数据库。
WebRTC data channels are basically “UDP on the web” but they have lots of controls to change how reliable they are, so they can be used as TCP style connections as well.
I still don’t fully understand why more people don’t use them over something like QUIC. (I think I’ve asked this question before here, but I wasn’t really satisfied with the answers)
I sadly switched off of using them, but mostly because the ecosystem around there is super underdeveloped compared to the ecosystem around QUIC/quinn. There is a LOT of boilerplate involved that feels unnecessary.
But, if you’re making a multiplayer game in the web, it’s basically the best technology to use cuz it already works. And if you use a library like libdatachannel or pion, you could make the game in Go or C++ and compile it for both Steam and the web!
Here’s a project I did with them that shows off compiled for both web and desktop: https://github.com/ValorZard/gopher-combat
reply