yjs / y-webrtc

WebRTC Connector for Yjs
MIT License
448 stars 109 forks source link

Explore options for smaller footprint, browser-based webrtc clients #35

Open lukebayes opened 2 years ago

lukebayes commented 2 years ago

After installing the y-webrtc package, my unminified JavaScript bundle went from 219.7kb to 417.6kb (197.9kb difference) and my minified bundle went from 90kb to 202kb.

I was naturally curious, so I found BundleBuddy and here's the report they generated. image

It looks like simple-peer represents the lion's share of the size increase (96kb minified) and a quick glance at the source file indicates there are quite a few nodejs modules being pulled into what is ostensibly meant to run in a browser.

I haven't dug deep into this yet, but thought I'd check in to see if anyone is already looking into ideas here.

Overall outstanding library and thanks so much for all your hard work!

dmonad commented 2 years ago

Hi @lukebayes,

Unfortunately, simple-peer is the best battle-proven webrtc solution out there. But feel free to investigate if there are alternatives with a smaller footprint, I'd be intrigued as well.

lukebayes commented 2 years ago

That's what I was afraid of. I'll see if I can schedule some time to dig in over the coming months.

Please feel free to close this ticket. I just wanted to be sure I wasn't jumping into something others were already pushing on.

Thanks!

dmonad commented 2 years ago

Alright, closing. But please feel free to reopen if you find alternatives.

neftaly commented 1 year ago

There's a fork of simple-peer that has the extra node modules removed, though it drops support for stream.Duplex. I don't know if it will be maintained however. https://github.com/gfodor/tiny-simple-peer

dmonad commented 1 year ago

This looks pretty cool. Thanks for sharing @neftaly!

I might accept a PR to switch to tiny-simple-peer. My only concern is whether this package works as reliably (well, as reliable as webrtc can be). The package seems as well maintained as simple-peer..

neftaly commented 1 year ago

@gfodor is it a good idea to use your fork of simple-peer? Would you accept PRs etc? Any chance you could please turn on issue tracking? Thanks!