PeerJS可以在不访问互联网的情况下制作本地流吗
我完成了对等JS服务器的设置,遵循这个url https://github.com/peers/peerjs-server。 设置遵循nodeJs + Express。
我还使用 Angular 应用程序设置客户端 PeerJs。当我连接到互联网时一切都很好。但一旦互联网关闭连接,我就会收到错误。我尝试让我的应用程序在本地网络中运行而无需访问互联网。
以下是我的peerJs 客户端配置。
我还在角度应用程序中将peerjs导入为本地。
在没有互联网连接的情况下启动应用程序时会出现以下错误。
任何人都可以建议在本地设置peerJs而无需访问互联网吗?
I done setup peerJS server follow this url https://github.com/peers/peerjs-server.
Setup follow by nodeJs + express.
I also setup client peerJs using angular Apps. Everything is fine when I have connection with internet. But I getting error once internet close connection. I try to make my apps running in local network without access internet.
Below is my configuration if peerJs client.
I also import peerjs as local in angular apps.
Below error appear once start apps without internet connection.
Any one can advise for setup peerJs locally without access internet?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PeerJS 服务器充当 WebRTC 信令服务器。
如果您在本地 (Wi-Fi) 网络中本地运行 PeerJS 服务器,并且您的对等方(客户端)位于同一网络中,则不需要互联网连接。
如果您的 PeerJS 服务器在不同的网络中可用(通过互联网),您的客户端可以选择以下选项:
建立互联网连接几秒钟:连接到 PeerJS 服务器,然后连接到对等点。现在您可以与 PeerJS 服务器断开连接(如果其他客户端仍在同一本地网络中,则可以与互联网断开连接)
如果另一个对等点位于同一本地网络中,您需要自己发送信号。
要向自己发出信号,您可以检查此代码: https://github.com/lesmana/ webrtc-without-signaling-server
这是一个演示/gif:https://mac-blog.org.ua/webrtc-one-to-one-without-signaling-server
在现实世界中,还存在一些其他障碍,例如防火墙和 NAT。为了解决这些问题,您需要 STUN 甚至 TURN(中继)服务器。
PeerJS server acts as a WebRTC signaling server.
If you're running PeerJS server locally in your local (Wi-Fi) network and your peers (clients) are in the same network, you don't need an internet connection.
If your PeerJS server is available in a different network (via internet), you have these options for your clients:
establish an internet connection for a few seconds: connect to the PeerJS server, then connect to a peer. Now you can disconnect from the PeerJS server (and from the internet if the other client is still in the same local network)
if the other peer is in the same local network, you need to do the signaling yourself.
To do signaling yourself you can check this code: https://github.com/lesmana/webrtc-without-signaling-server
here is a demo/gif: https://mac-blog.org.ua/webrtc-one-to-one-without-signaling-server
In a real world there are some other obstacles like firewalls and NAT. To solve them you need a STUN or even a TURN (relay) server.