Giter Site home page Giter Site logo

Problem with firefox and y-webrtc about y-webrtc HOT 4 OPEN

yjs avatar yjs commented on May 20, 2024 2
Problem with firefox and y-webrtc

from y-webrtc.

Comments (4)

jeffrafter avatar jeffrafter commented on May 20, 2024 3

@ikezedev ah, sorry I was referencing the buffered fork from @disarticulate. In the default y-webrtc the starting point is

const answer = readPeerMessage(this, data)
(which is passed into readPeerMessage and then readMessage as you pointed out). The type hints in the signature claim that a UInt8Array is expected but it is a blob. (There is another spot in the broadcast channel handling and I am not sure if that is another spot where this happens). I think the fix in the default would be to put this into the peer handler, convert the data and then pass the appropriate buffer into readPeerMessage.

from y-webrtc.

ikezedev avatar ikezedev commented on May 20, 2024 1

I am experiencing similar behaviour, firefox is not able to sync and if you turn on the y-webrtc logs, you'd see that it just log infinitely

from y-webrtc.

jeffrafter avatar jeffrafter commented on May 20, 2024 1

I don't have a fix for this but I think that the source of the error is that Firefox WebRTC peers don't deliver ArrayBuffer data by default. They deliver blobs. Thus new UInt8Array(data) has a length of 0 and it fails. In the onmessage handler we'll need something like:

      // https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/binaryType
      const buffer = peer.channel.binaryType === "arraybuffer" ? event.data : await event.data.arrayBuffer()

from y-webrtc.

ikezedev avatar ikezedev commented on May 20, 2024

@jeffrafter where is this onmessage handler, I can't find it in src/y-webrtc.js or you meant this?

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.