Giter VIP home page Giter VIP logo

Comments (6)

dmonad avatar dmonad commented on August 16, 2024 1

Sounds like overkill. But sure, that should work. You can mash yjs-providers however you want. But since there is unnecessary computational overhead you should probably only choose one of them. From what I hear, you want a "connected" event - indicating when you received the "latest state". That really only exist when you use y-websocket. There is no way to know when you synced with all y-webrtc peers (you don't know how many there are - because it's p2p).

from y-webrtc.

Ajayghoshm avatar Ajayghoshm commented on August 16, 2024

same here, how to make things reactive?

from y-webrtc.

dmonad avatar dmonad commented on August 16, 2024

The concept of "connected" is not well defined in y-webrtc. In y-websocket, we can say that we are connected to the server. But in y-webrtc, there are many different kinds of endpoints we are connected to.

I assume you are interested in whether you are connected to other peers? Then you could listen to the peers event (it is mentioned in the discussion you mentioned) and update a local variable whenever it is changed.

Observable is a simple class that enabled you to listen to events: instance.on('event', function). Yjs & y-webrtc are not reactive.

from y-webrtc.

Ajayghoshm avatar Ajayghoshm commented on August 16, 2024

True, i tried using the .on(peer,()=>{}) but it gives me inconsistent data, when i rejoin the same room again from the same system, instead of having only actual peer list, I have 3 or 4 peers based on the number of times i joined.

Refer screenshot

Screenshot 2023-05-05 at 8 31 52 AM

from y-webrtc.

dmonad avatar dmonad commented on August 16, 2024

That sounds about right. There is no distinction between a "remote" peer and a peer that is hosted on the same computer. Maybe you want to use y-websocket instead?

from y-webrtc.

Ajayghoshm avatar Ajayghoshm commented on August 16, 2024

I am trying to use both at same time, y-websocket and y-webrtc with a common awareness, will this approach have any issues?

from y-webrtc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.