livekit / client-sdk-js

LiveKit browser client SDK (javascript)
https://livekit.io
Apache License 2.0
378 stars 155 forks source link

P2P mesh #270

Closed no-1ne closed 2 years ago

no-1ne commented 2 years ago

Hello all, thanks for livekit Have a feature request, can clients connect p2p as a mesh and sending data among themselves while TURN and recording going livekit SFU way with an extra connection to SFU.

What do you think, can be energy efficient for attendees < 8 also saves outgoing bandwidth costs on SFU side.

Screenshot_20220617-044135528 (1)

https://element.io/blog/introducing-native-matrix-voip-with-element-call/

davidzhao commented 2 years ago

Hey @no-1ne, we do not have plans to support P2P mode.

In practice, it brings quite a bit of complexity to the system and makes is much harder to achieve high reliability. It also stresses users uplinks: upstream bandwidth constraints are very real. In real world applications, we've seen problems with P2P WebRTC in rooms with more than 3 participants.

aehlke commented 2 years ago

I'll just add that 3 participant realtime, or perhaps more if the data was not video (say, realtime comments in text), is still very useful. Having all user data go through servers is a big liability and privacy concern. I'll track this in lieu of that https://github.com/livekit/livekit/issues/303

no-1ne commented 2 years ago

Yes in meta world the visual updates can be sent on datachannel and an audio mesh which i hope with ogg encoding can handle 7-10 mesh

davidzhao commented 2 years ago

You are absolutely right that you can get WebRTC to work well with mesh where it's only sending data / low-bitrate audio. In that case using plain WebRTC would be the path forward, you wouldn't need LiveKit there.

E2EE is pretty important in a SFU topology, we'll use https://github.com/livekit/livekit/issues/303 to keep track of that request.

aehlke commented 2 years ago

In that case using plain WebRTC would be the path forward

Are you saying this is readily doable with plain WebRTC without a lib? Or that it's in as much a need of a lib and out of scope for LiveKit

davidzhao commented 2 years ago

It might be complex, but it's definitely possible to build it with WebRTC. The question is whether that complexity is handled by a library or within your own software.

And yes, this is out of scope for LiveKit.

bekriebel commented 2 years ago

I agree that LiveKit doesn't need the addition of p2p mesh. If you are looking for a good library to support that, I had good luck with https://github.com/feross/simple-peer

Their library is easy to work with and very lightweight. However, I ultimately went with LiveKit because p2p mesh wasn't a good fit for my use case.

no-1ne commented 2 years ago

Lot of plug and play devs seem to be using livekit and having a P2P mesh optimisation within that blackbox called livekit

I know it's a lot of effort adding that in all the respective clients. But in longer run good for nature in terms of energy.

On Wed, Aug 17, 2022, 2:25 AM Brint E. Kriebel @.***> wrote:

I agree that LiveKit doesn't need the addition of p2p mesh. If you are looking for a good library to support that, I had good luck with https://github.com/feross/simple-peer

Their library is easy to work with and very lightweight. However, I ultimately went with LiveKit because p2p mesh wasn't a good fit for my use case.

— Reply to this email directly, view it on GitHub https://github.com/livekit/client-sdk-js/issues/270#issuecomment-1217154986, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUEFOO7BCNONISQC3TFERDVZP53DANCNFSM5ZAKO72Q . You are receiving this because you were mentioned.Message ID: @.***>

aehlke commented 2 years ago

and having a P2P mesh optimisation within that blackbox called livekit

Can you elaborate what you mean by this?

no-1ne commented 2 years ago

livekit makes it so easy to add Live capabilities to any app even for a beginner having P2P optimization within lib would be helpful for such cases. It may also be provided in livekit pro, a paid only functionality (like tiptap.dev )

On Wed, Aug 17, 2022, 8:26 PM Alex Ehlke @.***> wrote:

and having a P2P mesh optimisation within that blackbox called livekit

Can you elaborate what you mean by this?

— Reply to this email directly, view it on GitHub https://github.com/livekit/client-sdk-js/issues/270#issuecomment-1218124368, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUEFOIVQI3MADKTJ5VYYE3VZT4STANCNFSM5ZAKO72Q . You are receiving this because you were mentioned.Message ID: @.***>