Giter VIP home page Giter VIP logo

Comments (5)

dmonad avatar dmonad commented on July 17, 2024 1

Oh nice! It makes sense as I simply assumed the second handler would be called after the first one (which might not be the case). Then I will publish a new release of this package as it seems to fix an issue.

from y-webrtc.

dmonad avatar dmonad commented on July 17, 2024

Right. I duplicated that because the close handler is not called when the error event is called. I should have combined that with the previous handler. Although I don't see how this can lead to issues?

from y-webrtc.

holtwick avatar holtwick commented on July 17, 2024

After I removed the part completely my issues were gone. The problem was that peers message was emitted, first to with payload telling to remove the peer and then afterwards another one that tried to add it again.

Maybe somewhere here?

y-webrtc/src/y-webrtc.js

Lines 267 to 277 in e0d5d11

const announceSignalingInfo = room => {
signalingConns.forEach(conn => {
// only subcribe if connection is established, otherwise the conn automatically subscribes to all rooms
if (conn.connected) {
conn.send({ type: 'subscribe', topics: [room.name] })
if (room.webrtcConns.size < room.provider.maxConns) {
publishSignalingMessage(conn, room, { type: 'announce', from: room.peerId })
}
}
})
}

from y-webrtc.

dmonad avatar dmonad commented on July 17, 2024

Maybe this is a misunderstanding. The intention is that y-webrtc automatically handles (and reconnects) connections unless you explicitly disconnect the provider instance (then no connection should be possible anymore).

So when the connection to a peer is closed, then it will automatically subscribe to find more peers again.

from y-webrtc.

holtwick avatar holtwick commented on July 17, 2024

Whatever the reason was, your change fixed the issue. I had two browser windows being connected via y-webrtc and when reloading one of them the other one showed 2 connections. This is fixed now, probably due to the duplicate listening to 'close' being removed. Thanks!

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.