bugout: Getting error connecting to tracker

If I try to use bugout for either my own project or use one of the demos from the README provided, I get the following error in the browser console:

WebSocket connection to 'wss://hub.bugout.link/' failed: Error in connection establishment: net::ERR_CONNECTION_RESET
WebSocket connection to 'wss://tracker.btorrent.xyz/' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID
WebSocket connection to 'wss://hub.bugout.link/' failed: Connection closed before receiving a handshake response

This was not happening before, and just saw this today when I got back to a project that I was working on The connection between two peers which was working before is not working anymore I tried on both Firefox as well as Chrome, the result is no different Also, I’m not running any ad-blocker or site-blocker I also tried it on two different networks, the problem persists

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 34 (11 by maintainers)

Most upvoted comments

@phyreman I built a simple WebTorrent tracker server that can be deployed to Heroku with 1 click that you could use for your projects. You can also clone the repo and run it locally or anywhere else.

https://github.com/draeder/p2p-tracker

@hello-smile6 I’ve been thinking about that. One of the ways I’ve considered doing this is with the library called Hyperswarm. Basically, when a peer requests a torrent that the initial server doesn’t have, it will create a hyperswarm instance using that torrent’s infohash as the swarm identifier. Another server with that infohash will already have a hyperswarm instance for that active torrent, then relay its known peers to the requesting peer, and vice versa to the peers the other server has. If there is no active hyperswarm for that infohash, no trackers know about that torrent so the server behaves as a normal tracker server at that point.

I’ve been diving into things like Kademlia, DHT, webtorrent extensions, simple-peer, and I think I’m getting pretty close to being able to build this.

@draeder , Hi I’m running your p2p tracker locally since I was getting failed connection errors to tracker.bttorrent.xyz and hub.bugout.link and I’m not sure if I’m using it correctly.

In the server side, my Bugout instance is:

const serverAddressText = document.querySelector("#server-address");
    const b = new Bugout("DemoBugout",{
      announce:["localhost:3001"]
    });
    console.log(b.address())
    serverAddressText.innerText = `Bugout server address :${b.address()}`;
    b.register("ping-server", function(address, args, callback) {
      console.log(args.message)
      args.message = "Hello from server: " + b.address();
      callback(args);
    });

Whereas the client-side code is:

const key = prompt("Enter server key")
    const statusMessage = document.querySelector("#status-message");
    var b = new Bugout(key,{
      announce:["localhost:3001"]
    });
    b.on("server", function(address) {
    statusMessage.innerText = `Connected to server with address ${key}`
    console.log("connected to server")
      b.rpc("ping-server", {"message": `Hello from client: ${b.address()}`}, function(result) {
      console.log(result.message);
    });
  });

Is this the correct way of using the p2p tracker?

Two issues, I think.

const key = prompt("Enter server key")
    const statusMessage = document.querySelector("#status-message");
    var b = new Bugout(key,{
      announce:["ws://localhost:3001/"]
    });
    b.on("server", function(address) {
    statusMessage.innerText = `Connected to server with address ${key}`
    console.log("connected to server")
      b.rpc("ping-server", {"message": `Hello from client: ${b.address()}`}, function(result) {
      console.log(result.message);
    });
  });
const serverAddressText = document.querySelector("#server-address");
    const b = new Bugout({
      announce:["ws://localhost:3001/"]
    });
    console.log(b.address())
    serverAddressText.innerText = `Bugout server address :${b.address()}`;
    b.register("ping-server", function(address, args, callback) {
      console.log(args.message)
      args.message = "Hello from server: " + b.address();
      callback(args);
    });

You forgot to add the ws:// protocol string for the tracker URLs. Also, your server was trying to connect to a Bugout room, which could cause unpredictable behavior.

Hi @draeder - thank you for this! I just deployed the heroku server - but when I use it in the announce option (as per the docs here), it never finds any peers. Is there something I’m missing?