Skip to content

Long delay before "Go private" button is enabled #55

Open

Description

@draeder

Running this on localhost in two browser tabs. The "Go private" button does not enable in a timely fashion, sometimes taking up to a minute or more.

Activity

  1. AdamSEY commented on Feb 26, 2020

    @AdamSEY

    That was just an example, you can enable that by yourself as follows:

    const p2p = new P2P(socket);

    setInterval(function(){
    if (p2p.usePeerConnection === true){
    // now the connection is established and ready
    }else{
    // the connection is not ready yet
    }

    }, 1000);

  2. twofingerrightclick commented on Nov 5, 2020

    @twofingerrightclick

    For future readers: Remove the "trickle" parameter from the constructor in the chat example. That is what is done in the example above -> By only passing the socket the SocketIOp2p constructor, the default params are 5 clients, and autoUpgrade: true. So as soon as clients can connect to eachother they are "upgraded" to webRTC. I am not sure what the trickle parameter is... could find the documentation yet

  3. jasonkester commented on Apr 7, 2026

    @jasonkester

    I was able to fix this by setting trickle: true in that peerOpts object.

    That fixed the problem, but introduced a new one where the server would crash if either browser reloaded. The fix for that was to modify socket.io-p2p-server.js to not try to use client methods if the client doesn't exist. As in:

    Line 44:

    client?.emit('peer-signal', data)
    

    That little question mark is all it took. I pulled the file out of node modules and am now referencing it directly. At some point somebody who cares about such things should make a PR for that project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions