Giter Site home page Giter Site logo

Comments (4)

dmonad avatar dmonad commented on May 20, 2024 1

Mi Max,

What kind of overhead are you talking about?

Cursor positions should be propagated using the awareness protocol. https://github.com/yjs/y-protocols#awarenessprotocolawareness-class

In most cases, the Awareness instance should work better than implementing your own protocol. y-webrtc doesn't guarantee a totally connected network so you need some CRDT to propagate data. Otherwise, you will likely run into sync issues.

If you are interested we can discuss an extension to the y-webrtc protocol that handles custom messages. Some kind of "custom" message format.

from y-webrtc.

dmonad avatar dmonad commented on May 20, 2024 1

Hi @maxkrieger , you could wait for the key promise.

Before we can create a room, we need to compute the encryption key which is an asynchronous background call.

The proper way to wait for the room would be provider.key.then(() => { provider.room != null })

from y-webrtc.

maxkrieger avatar maxkrieger commented on May 20, 2024

This was exactly what I needed, thanks so much!

Btw, for streams, I only have access to the peerId because of the way the simple-peer api works -- but I'd like to match that peerId with its corresponding ydoc id immediately so that I know whose stream is whose. I was thinking of attaching the room.peerId to each peer's awareness state as soon as it becomes available so that I can match up the proper stream just by querying the awareness states for the right peerId.

However the room is null until the client connects to the TURN(?) servers, so I can't access my own peerId until some inaccessible connect event. Right now I'm just waiting for the first event to come through to check the room object, but is there a more principled way of getting my peerId as soon as it's available?

from y-webrtc.

maxkrieger avatar maxkrieger commented on May 20, 2024

Thanks so much!

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.