yjs/y-webrtc

filterBcConns = true doesn't work

areebbeigh opened this issue · 3 comments

Using filterBcConns: true in options still uses broadcast channels instead of a webrtc connection for tabs in the same browser. Tested on Chrome: Version 79.0.3945.79 (Official Build) (64-bit) and Firefox: 74.0 (64-bit) on Ubuntu 18.04

the same happens to me.
I believe the option should be disableBroadcastChannels and do not even subscribe/unsuscribe on connect/disconnect

I suppose I wasn't paying enough attention. filterBcConns: false is what makes sense is what works if I want browser tabs to use webRTCConns. I think the readme has it wrong.

That, or the default value in the constructor is should be false, not true - which makes more sense since filterBcConns is basically hypothetical !allowBcConns?

All Yjs connectors use broadcastchannels to exchange document updates efficiently window-to-window. It is a cheap method to exchange document updates when no internet connection is available.

It doesn't make sense to me to disable the broadcastchannel (there is no advantage in that).
Creating a webrtc connection instead of a broadcastchannel will just delay syncing. Furthermore, it is not possible to create WebRTC connection without a network connection.

The idea is that a WebRTC connection is only created if the client is not already connected via broadcastchannel. Therefore, filterBcConns.

But you are right @areebbeigh . The mentioned section is wrong.