TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

PeerJS – Simple peer-to-peer with WebRTC

214 点作者 caminocorner超过 4 年前

18 条评论

capableweb超过 4 年前
Fun fact about PeerJS, you&#x27;ll need a server in order to use it (look into STUN&#x2F;TURN&#x2F;ICE for more info). The maintainer seems to be hosting one default instance that goes down from time to time. <a href="https:&#x2F;&#x2F;github.com&#x2F;peers&#x2F;peerjs&#x2F;issues&#x2F;671" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;peers&#x2F;peerjs&#x2F;issues&#x2F;671</a> <a href="https:&#x2F;&#x2F;github.com&#x2F;peers&#x2F;peerjs&#x2F;issues&#x2F;693" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;peers&#x2F;peerjs&#x2F;issues&#x2F;693</a><p>If you&#x27;re looking to do &quot;pure&quot; P2P in the browser, we&#x27;re not there yet as we cannot accept incoming connections without something in between right now.
评论 #25660935 未加载
评论 #25659866 未加载
评论 #25660130 未加载
评论 #25659216 未加载
评论 #25663961 未加载
评论 #25661255 未加载
评论 #25667018 未加载
评论 #25663948 未加载
评论 #25665732 未加载
评论 #25659062 未加载
ScottyFillups超过 4 年前
If anyone is looking for an alternative to PeerJS, I highly recommend simple-peer by feross: <a href="https:&#x2F;&#x2F;github.com&#x2F;feross&#x2F;simple-peer" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;feross&#x2F;simple-peer</a><p>I created multi party P2P audio&#x2F;video chat in ~200 lines of code a while back, here it is: <a href="https:&#x2F;&#x2F;github.com&#x2F;ScottyFillups&#x2F;p2pchat" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ScottyFillups&#x2F;p2pchat</a> (see room.js and all the files under client&#x2F;)<p>Demo page is here: <a href="https:&#x2F;&#x2F;scottyfillups.io&#x2F;p2pchat" rel="nofollow">https:&#x2F;&#x2F;scottyfillups.io&#x2F;p2pchat</a>
评论 #25660309 未加载
评论 #25661149 未加载
评论 #25666395 未加载
qeternity超过 4 年前
There&#x27;s a big opportunity in the rtc space for someone to build a lib&#x2F;service that &quot;just works&quot;. We built a probject that started with peerjs for the prototype and then moved to simple-peer for the prod version, but it&#x27;s still a nightmare in webrtc land. All sorts of random errors and quirks, connection glaring, reconnect handling, etc. This is still very much an unsolved problem.
评论 #25661316 未加载
评论 #25665181 未加载
评论 #25660013 未加载
评论 #25659965 未加载
评论 #25661153 未加载
mrozbarry超过 4 年前
I tried PeerJS in a pet project a few months ago. The one thing that became immediate is peer to peer over browsers isn&#x27;t great. You can basically throw testing out the window, there is no good way to emulate p2p locally. Trying to test my PeerJS project involved having two computers, and occasionally required one to be connected through a VPN. Problems I found was connecting over LAN was really flaky. Most times, Chrome to Chrome was fine. Chrome to firefox was also mostly fine. Firefox to Firefox had a pile of quirks - connections only worked if I completely quit firefox, and started it again with just my two windows, and even then, sometimes that connection failed.<p>The ICE&#x2F;Turn server stuff is also a mess. I ended up installing and hosting a coturn server on digital ocean, and it was a pain. Documentation wasn&#x27;t great, stackoverflow&#x2F;forum questions were typically old, and there didn&#x27;t appear to be any obvious alternatives.<p>I also tried simple-peer by feross, which seemed to be fine, and most quirks remained as browser issues.<p>I ended up ditching webrtc and went with a server with websockets. With peer to peer, I&#x27;m stuck using a server somewhere, so I&#x27;d rather use a websocket server. Webrtc just introduced too many unknown variables. Is there a problem with an ICE&#x2F;Turn server? Is there a LAN issue? Can browsers vendors properly do p2p to each other without a bunch of &quot;if firefox, do this, if chrome, do this, if something else, panic&quot;? The websocket server took 100% of these concerns out of the equation.<p>I&#x27;d love to be able to use webrtc confidently, but with the current tools for implementing and testing, I don&#x27;t think I can say it is for myself.<p>So I think the TLDR is that webrtc peer to peer isn&#x27;t really consumer-ready. The browser support seems a little hit and miss, testing through a LAN appears to be very flaky, and testing via node&#x2F;some other framework is spotty at best.
评论 #25660844 未加载
评论 #25659805 未加载
评论 #25670567 未加载
Sean-Der超过 4 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;muka&#x2F;peerjs-go" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;muka&#x2F;peerjs-go</a> is a Go implementation. I believe there is also effort to make a Python one.<p>It is pretty exciting to have such an easy way to have processes in different languages (and different networks!) communicate.<p>I would really love to find a way to drop the server dependency even <a href="https:&#x2F;&#x2F;sean-der.github.io&#x2F;webrtc-uri&#x2F;draft-seaduboi-webrtc-uri.html" rel="nofollow">https:&#x2F;&#x2F;sean-der.github.io&#x2F;webrtc-uri&#x2F;draft-seaduboi-webrtc-...</a> mDNS&#x2F;Zerconf would be amazing. Even if it just works between WebRTC Agents and not the browser.
arange超过 4 年前
here&#x27;s a really great article by the people who wrote WireGuard as to why P2P is really hard to do: <a href="https:&#x2F;&#x2F;tailscale.com&#x2F;blog&#x2F;how-nat-traversal-works&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tailscale.com&#x2F;blog&#x2F;how-nat-traversal-works&#x2F;</a>
评论 #25689822 未加载
KaoruAoiShiho超过 4 年前
It&#x27;s honestly too simple, more work has to be done to get it to be actually useful and scalable.
评论 #25659148 未加载
评论 #25659996 未加载
markkudlac超过 4 年前
I used PeerJS for a project, <a href="http:&#x2F;&#x2F;subsect.net" rel="nofollow">http:&#x2F;&#x2F;subsect.net</a> , that has been running for a few years. I have run my own PeerServer on Heroku all of that time without incident. I have tested connectivity over WebRTC from many places around the world and have never had a problem other than from the lobbies of some banks as it seems they generally block IP traffic.<p>WebRTC is a transitional technology and I look forward to the day blocks of IPv6 addresses are granted free to all people at birth and fixed addresses are supported on all devices.
godot超过 4 年前
Wow, this seems really cool. I&#x27;ve looked into WebRTC before and every time I try to read the specs to see if I can implement something, I was turned away by how difficult it seems to be to get everything going to do hello world examples. This seems to simplify all of that and I&#x27;d love to try it out some time.<p>Related question, does anyone know how heavy of a load is a STUN&#x2F;TURN server? If I build a hobby project using this, and use a (for example) Heroku free tier dyno to host a STUN&#x2F;TURN nodejs server, how many users&#x2F;traffic can I expect to be able to run?
评论 #25666863 未加载
lrossi超过 4 年前
They might want to update their demo page. The only demo link leads to a parked domain thingy with just ads.
nashashmi超过 4 年前
OT: I was trying to use this for a glorified multi-stream mobile video casting to a Zoom streaming server. I used a nodejs instance which was very easy to set up.<p>But I could not find a solution for an in browser mobile weberc video solution. Pretty much all implementations went through an app.
wortmanager超过 4 年前
I bounced off the documentation for STUN&#x2F;TURN servers about a month ago when I was trying to make a chrome addon to stream a tab to a group of people who click a link.<p>I also got hung up on trying to use WebRTC with Next.js<p>Might be time to simplify my stack a little and try again.
wesz超过 4 年前
My own attempt at creating simple to use wrapper for WebRTC: <a href="https:&#x2F;&#x2F;github.com&#x2F;wesz&#x2F;Peer" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wesz&#x2F;Peer</a>
miohtama超过 4 年前
Also see libp2p for complex use cases<p><a href="https:&#x2F;&#x2F;github.com&#x2F;libp2p&#x2F;js-libp2p-webrtc-star" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;libp2p&#x2F;js-libp2p-webrtc-star</a>
dest超过 4 年前
Check out <a href="https:&#x2F;&#x2F;streamroot.io" rel="nofollow">https:&#x2F;&#x2F;streamroot.io</a> if you want to work professionally on this kind of thing (demo at the bottom)
dangerboysteve超过 4 年前
The demo link looks like it redirects to a fake virus warning site.<p><a href="https:&#x2F;&#x2F;peerjs.com&#x2F;examples.html" rel="nofollow">https:&#x2F;&#x2F;peerjs.com&#x2F;examples.html</a>
michjedi超过 4 年前
This stopped being supported half a decade ago
评论 #25659723 未加载
评论 #25660184 未加载
ht96超过 4 年前
Can anyone recommend something this simple but for multi party conferencing like Zoom
评论 #25660146 未加载
评论 #25660121 未加载