Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPS clients can't discover each other, but can discover and be discovered by HTTP-only clients #30

Open
ccashwell opened this issue Mar 1, 2018 · 4 comments

Comments

@ccashwell
Copy link

This demo code doesn't seem to work once pushed behind an HTTPS endpoint. Specifically, HTTPS clients are communicating with the signaling server, but they're never made aware of one another. HTTP-only clients don't have this issue, and the interesting part is that an HTTP-only client can also discover and be discovered by HTTPS clients. There's just the disconnect between HTTPS clients and other HTTPS clients.

I thought maybe it was the signaling server, so I deployed my own libp2p-websocket-star rendezvous server to no avail. Am I missing something?

@ccashwell
Copy link
Author

ccashwell commented Mar 1, 2018

After communicating with the libp2p team a bit more, I'm unsure where in the IPFS/libp2p stack this is occurring. The following is a simplified version of the code I'm using to test ipfs-pubsub-room:

import IPFS from 'ipfs'
import Room from 'ipfs-pubsub-room'

(() => {
  this.ipfs = new IPFS({
      EXPERIMENTAL: { pubsub: true },
      repo: `ipfs/mythereum/${Math.random()}`,
      config: {
        Addresses: {
          Swarm: [
            // note: I've also tried replacing these with a self-hosted rendezvous, same issue
            // whether it's my self-hosted server or any of the hosted ones I've discovered
            '/dnsaddr/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star',
            '/dnsaddr/ws-star-signal-1.servep2p.com/tcp/443/wss/p2p-websocket-star',
            '/dnsaddr/ws-star-signal-2.servep2p.com/tcp/443/wss/p2p-websocket-star',
            '/dnsaddr/ws-star-signal-3.servep2p.com/tcp/443/wss/p2p-websocket-star'
          ]
        }
      }
    })

    // IPFS node is ready, so we can start using ipfs-pubsub-room
    this.ipfs.on('ready', () => {
      this.ipfs.id((err, info) => {
        if (err) { throw err }
        console.log("Connected to IPFS as " + info.id)
      })

      this.gameLobby = Room(this.ipfs, 'game-lobby-079a4d')

      this.gameLobby.on('peer joined', (peer) => {
        let event = { event: "peer_joined", id: peer }
        console.log(JSON.stringify(event))
      })

      this.gameLobby.on('peer left', (peer) => {
        let event = { event: "peer_left", id: peer }
        console.log(JSON.stringify(event))
      })

      this.gameLobby.on('message', (message) => {
        let payload = JSON.parse(message.data.toString())
        console.log(payload)
      })
    })
})()

I've ruled out browser-specific issues by testing each affected machine with the IPFS benchmark tool which connects me (and every other browser I've tested) to other peers as expected.

@harrshasri
Copy link

harrshasri commented Apr 3, 2018

I think you need to remove Math.Random() when deploying.
When you are doing locally you need Math.Random() for uniqueness on the same client.

And one of my implementation is working on https on firebase.

@eolszewski
Copy link
Contributor

@harrshasri can you link to that implementation?

@sriharrsha
Copy link

@eolszewski Link

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

No branches or pull requests

4 participants