我可以为同一专用网络上的计算机简化 WebRTC 信令吗? [英] Can I simplify WebRTC signalling for computers on the same private network?

查看:21
本文介绍了我可以为同一专用网络上的计算机简化 WebRTC 信令吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WebRTC 信号让我发疯.我的用例非常简单:信息亭和控制室 web 应用程序之间的双向音频对讲机.两台电脑都在同一个网络上.两者都无法访问互联网,所有机器都有已知的静态 IP.

WebRTC signalling is driving me crazy. My use-case is quite simple: a bidirectional audio intercom between a kiosk and to a control room webapp. Both computers are on the same network. Neither has internet access, all machines have known static IPs.

我阅读的所有内容都希望我使用 STUN/TURN/ICE 服务器.这个的首字母缩写词是无穷无尽的,导致我的偏头痛,但如果这是一个标准应用程序,我只需打开一个端口,告诉另一个客户端(如果需要,我可以通过 webapp 执行此操作)并让另一个连接.

Everything I read wants me to use STUN/TURN/ICE servers. The acronyms for this is endless, contributing to my migraine but if this were a standard application, I'd just open a port, tell the other client about it (I can do this via the webapp if I need to) and have the other connect.

我可以用 WebRTC 做到这一点吗?不运行十几个信令服务器?

Can I do this with WebRTC? Without running a dozen signalling servers?

举个例子,你如何将运行在 192.168.0.101 上的浏览​​器连接到运行在 192.168.0.102 上的浏览​​器?

For the sake of examples, how would you connect a browser running on 192.168.0.101 to one running on 192.168.0.102?

推荐答案

STUN/TURN 与信号不同.WebRTC 中的 STUN/TURN 用于收集 ICE 候选对象.信令用于在这两台 PC 之间传输会话描述(提供和应答).您可以使用免费的 STUN 服务器(例如 stun.l.google.comstun.services.mozilla.org).也有免费的 TURN 服务器,但不是太多(这些是资源昂贵的).一种是 numb.vigenie.ca.

STUN/TURN is different from signaling. STUN/TURN in WebRTC are used to gather ICE candidates. Signaling is used to transmit between these two PCs the session description (offer and answer). You can use free STUN server (like stun.l.google.com or stun.services.mozilla.org). There are also free TURN servers, but not too many (these are resource expensive). One is numb.vigenie.ca.

现在没有信令服务器,因为这些是自定义的,可以通过多种方式完成.这是我写的文章.我现在在客户端使用 Stomp,在服务器端使用 Spring.

Now there's no signaling server, because these are custom and can be done in many ways. Here's an article that I wrote. I ended up using Stomp now on client side and Spring on server side.

我想您可以篡改 SDP 并静态注入 ICE 候选对象,但是您仍然需要以某种方式在这两台 PC 之间交换 SDP(并且这是每个会话以动态方式生成的).即使如此,考虑到配置不会改变,我想你可以交换一次(通过复制粘贴的方式:)),将其存储在某处,每次使用.

I guess you can tamper with SDP and inject the ICE candidates statically, but you'll still need to exchange SDP (and that's dinamycally generated each session) between these two PCs somehow. Even though, taking into account that the configuration will not change, I guess you can exchange it once (through the means of copy-paste :) ), stored it somewhere and use it every time.

这篇关于我可以为同一专用网络上的计算机简化 WebRTC 信令吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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