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

js/go interop not working #718

Closed
dryajov opened this issue Jan 18, 2017 · 10 comments
Closed

js/go interop not working #718

dryajov opened this issue Jan 18, 2017 · 10 comments
Labels
kind/bug A bug in existing code (including security flaws) kind/support A question or request for support

Comments

@dryajov
Copy link
Member

dryajov commented Jan 18, 2017

I've been trying to get ipfs-go and js-ipfs to work together, but so far I haven't been able to. Here is what I've done:

(I'm on a Mac book pro version 10.11.6 (15G1212))

  • run the ipfs go daemon
  • run the ipfs js daemon
  • add a file in ipfs go (ipfs add hello.txt)
  • cat a file in ipfs js (jsipfs cat <hash of file>)

After hanging for close to 1 minute jsipfs crashes with:

/Users/m90570/.nvm/versions/node/v6.5.0/lib/node_modules/ipfs/src/cli/commands/files/cat.js:27
        throw err
        ^

Error: socket hang up
    at createHangUpError (_http_client.js:252:15)
    at Socket.socketOnEnd (_http_client.js:344:23)
    at emitNone (events.js:91:20)
    at Socket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

From what I understand, interop has been implemented and it is working, has it not been released or is this is bug?

What I'm trying to accomplish is running IPFS inside a service worker and proxying requests over to IPFS to bootstrap a web app (almost) completely over IPFS #127.

@dignifiedquire
Copy link
Member

What version of go-ipfs are you using? Interop is currently only working with master, not with 0.4.4. Also you need to manually connect the two instances via swarm connect <id>

@dryajov
Copy link
Member Author

dryajov commented Jan 18, 2017

Here are the versions.

$ ipfs --version
ipfs version 0.4.4
$ jsipfs version
js-ipfs version: 0.21.0

That must be the issue.

Also, do I have to connect both as in:

ipfs swarm connect <js ipfs id>
jsipfs swarm connect <go ipfs id>

@daviddias
Copy link
Member

@dryajov you just need to connect one of the sides and you have to use a valid multiaddr (not just the Id).

The reason why they don't connect to each other is because of this: libp2p/go-libp2p#176

You will find some issues with larger files from js to go, due to libp2p/js-libp2p-spdy#48. We are putting a lot of energy into solving this issue, expect for updates soon.

@daviddias daviddias added kind/bug A bug in existing code (including security flaws) kind/support A question or request for support status/deferred Conscious decision to pause or backlog labels Jan 19, 2017
@dryajov
Copy link
Member Author

dryajov commented Jan 19, 2017

Thanks @diasdavid.

I was able to get the go and js implementations to talk to each other, I also ran in the the file limit issue. Thanks for pointing this out.

I'll file separate bugs for it, but so far the issues I've ran into trying to run ipfs in a ServiceWorker are related to the WebCrypto API, which are being looked up in the window global object explicitly, however window is not defined inside a service worker, although it does expose the crypto API as a WebWorker global, my solution so far has been to remove the explicit window lookup. I think in the context of the browser it should be pretty safe to just do if(crypto)/if(typeof crypto !== 'undefined'), rather than relying on window explicitly. Also, this is helpful #720 👍

@dignifiedquire
Copy link
Member

@daviddias
Copy link
Member

Also, keep an eye on:

They will be complete tutorials on how to get everything to work smoothly :)

@dryajov
Copy link
Member Author

dryajov commented Jan 20, 2017

@dignifiedquire Yep... that should take care of it, thanks.

@dignifiedquire
Copy link
Member

@dryajov master now is now transferring files with go-ipfs 0.4.6-rc.1 happily if you enable multiplex. Can we close this issue?

@dryajov
Copy link
Member Author

dryajov commented Feb 24, 2017

Yep, closing.

@dryajov dryajov closed this as completed Feb 24, 2017
@Kubuxu Kubuxu removed the status/deferred Conscious decision to pause or backlog label Feb 24, 2017
@daviddias
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug A bug in existing code (including security flaws) kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

4 participants