Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Make the Readme and example clearer, so that it's easier to get running #59

Open
zrg-team opened this issue Oct 2, 2018 · 18 comments
Open

Comments

@zrg-team
Copy link

zrg-team commented Oct 2, 2018

/dns4/ws-star-signal-1.servep2p.com/tcp/443/wss/p2p-websocket-star/

websocket.js:112 WebSocket connection to 'wss://ws-star-signal-1.servep2p.com/socket.io/?EIO=3&transport=websocket' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
const ipfsOptions = {
  EXPERIMENTAL: {
    pubsub: true
  },
  repo: '/ipfs.only/chatme/browser/ipfs/0.9.6',
  start: true,
  config: {
    Addresses: {
      Swarm: [
        '/dns4/ws-star-signal-1.servep2p.com/tcp/443/wss/p2p-websocket-star'
      ]
    }
  }
}
@jacobheun
Copy link
Contributor

The readme example/instructions need to be updated. We do host a rendezvous server for demos and experimenting at /dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star. This shouldn't be used for production.

The ws-star-signal-1.servep2p.com address actually points to 127.0.0.1, which requires you to run your own rendezvous server locally. Directions for installing and running rendezvous locally are at https://github.com/libp2p/js-libp2p-websocket-star-rendezvous#usage.

Running a rendezvous server, rendezvous --port=9090 --host=127.0.0.1, will give you access to a swarm address of /dns/ws-star-signal-1.servep2p.com/tcp/9090/ws/p2p-websocket-star/.

@jacobheun jacobheun changed the title ERR_CONNECTION_REFUSED Make the Readme and example clearer, so that it's easier to get running Oct 2, 2018
@mkg20001
Copy link
Member

mkg20001 commented Oct 2, 2018

@jacobheun Note that ws-star-signal-1.servep2p.com was my self-hosted instance which I took down a few months ago because protocol labs is now hosting one. I only kept the subdomain to avoid people grabbing it

@jacobheun
Copy link
Contributor

@mkg20001 ah, that's good to know, thanks! We should make sure to switch the host on examples using local rendezvous servers so we're not referencing that anymore. The rendezvous repo will also need to get updated with this.

@aphelionz
Copy link

aphelionz commented Oct 20, 2018

I'm having trouble using js-ipfs in the browser to connect to a remote rendezvous server.

Firstly, setting up IPFS like this:

this._ipfs = new Ipfs({                                                      
  EXPERIMENTAL: {                                                            
    pubsub: true                                                             
  },                                                         
  config: {                                                            
    Bootstrap: [                                                             
      "/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star/",   
    ]
  }
});

throws an error: [1] "0" must be in IPFS format�

Then, even if I just write a simple WebSocket test script:

websocket = new WebSocket("wss://ws-star.discovery.libp2p.io:443");

It tells me WebSocket connection to 'wss://ws-star.discovery.libp2p.io/' failed: Error during WebSocket handshake: Unexpected response code: 502

@jacobheun
Copy link
Contributor

@aphelionz the error you're hitting is due to the Bootstrap address not being an ipfs address (default addresses for bootstrap are here). Anything in config.Bootstrap is going to get dialed to, and it expects that to be an ipfs node. The discovery server should be used in the swarm addresses field

config: {
    Addresses: {
      Swarm: [
        '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star/'
      ]
    }
  }

which will have the ipfs node listen to connections from that server.

@aphelionz
Copy link

@jacobheun thanks for the clarification. Is there anything I can do on the server side so that it's not refusing connections?

@jacobheun
Copy link
Contributor

@aphelionz are you getting errors with the updated configuration? Or are you trying to hit it directly with WebSocket script you referenced above?

If you're using the script, I'm not sure which library you're using or what the rest of the script looks like, but libp2p-websocket-star does some processing of the address so the final dial actually looks like https://ws-star.discovery.libp2p.io if it has been given the discovery services multiaddress.

@aphelionz
Copy link

Thank you. So now I have:

this._ipfs = new Ipfs({
  EXPERIMENTAL: {
    pubsub: true,
    relay: {
      enabled: true
    }
  },
  config: {
    Bootstrap: [
      "/dns4/us-east-2a.ipfs.tallylab.com/tcp/4003/wss/ipfs/QmUjqjKVmWiXJp9HxBJ...'
    ],
    Addresses: {
      Swarm: [
        '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star/'
      ]
    }
  }
});

That gives me this error in Chrome on Ubuntu:

image

@aphelionz
Copy link

On the server side, I'm just running the rendezvous docker container with default settings

@jacobheun
Copy link
Contributor

@aphelionz I think that error is related to ipfs/js-ipfs#1620. Do you have other dependencies you're using like ipfs-repo, datastore-core, or interface-datastore? They may need to be updated. If that doesn't fix it, let's move the conversation to that issue.

@litzenberger
Copy link

@jacobheun Should this work?

    node = new IPFS({ repo: String(uuidv1()),
      config: { 
        Addresses: {
        Swarm: [
          '/dns/ws-star-signal-1.servep2p.com/tcp/9090/ws/p2p-websocket-star/'
        ]
      } } })
    }

I receive this validation error:

joi-browser.js:4174 Uncaught (in promise) Error: {
  "repo": "f48419c0-1345-11e9-a1b5-810f74faa607",
  "config": {
    "Addresses": {
      "Swarm": [
        "/dns/ws-star-signal-1.servep2p.com/tcp/9090/ws/p2p-websocket-star/" �[31m[1]�[0m
      ]
    }
  }
}
�[31m
[1] "0" no protocol with name: dns�[0m

@mkg20001
Copy link
Member

mkg20001 commented Jan 8, 2019

@litzenberger you need to use ’dnsaddr’ instead of ’dns’ for it to work. Also ws-star-signal-1 has been replaced with ws-star.discovery.libp2p.io

@litzenberger
Copy link

@mkg20001 Thanks. Looks like I'm still missing something. Now I get 'Error: There is already a transport with this key'

@jacobheun
Copy link
Contributor

@litzenberger what version of libp2p are you running? There was an issue with this in the browser but this should be fixed in libp2p@0.24.2 ipfs/js-ipfs#1699 (comment)

@litzenberger
Copy link

@jacobheun thanks, I updated to the latest lib2p2. Does this work in the js-ipfs 0.33.1 version or does it have to run off the master branch?

@jacobheun
Copy link
Contributor

It will have to be off master, until 0.34 is released. Hopefully within the next week.

@mkg20001
Copy link
Member

Can this be closed?

@jacobheun
Copy link
Contributor

@mkg20001 not yet, the example in the readme is wrong and needs to be updated. Right now it's using an old libp2p constructor and is just dialing to itself which is going to fail. Ideally I think we should just create an examples folder and have a 1.js and 2.js style setup running a local rendezvous server for it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants