I run a go-ipfs server with a websocket.
I enable wss via a Nginx proxy to that websocket.
I connect the browser via wss (with js-ipfs).
In the browser I request a file and when it is in the cache of my server, the browser gets it fine.
But when the browsers requests a file that is not in the server cache, the browser never gets the file.
If i request the file in another browser via the gateway on the server at 8080, I do get the file. And of course it is then also in the cache. So when I then try to get it in the browser via wss, I do get the file.
Thanx for any help!
When the user requests data through a node’s gateway, the node node will search the network for the requested file. However, when an IPFS peer (e.g., a js-ipfs node) asks another node (e.g., a go-ipfs node) via bitswap (our peer-to-peer file transfer protocol), the go-ipfs node will not search the network for the requested file.
Basically, this is because we consider the API/gateway to be privileged, private-by-default interfaces to the IPFS node. They’re designed to be used by the owner of the node.
Node (js-ipfs) Node (go-ipfs)
^ ^
| |
+-----+------+
| public
Node (go-ipfs) --------------------------
| private
+-----+------+
| |
v v
App (API) Browser (Gateway)
However, if you have the circuit transport enabled, your browser node should be able to relay to other nodes through your go-ipfs node.
Thanx for helping! Any pointers to how to enable the circuit transport?
What I want to achieve is have 2 browser apps at 2 different locations being able to get each others IPFS files.
For instance I add a file in browser A with js-ipfs and get a hash. Then in browser B I cat the hash and expect the file to be retrieved from A somehow.
B does not have any knowledge of the existence of A, but A is online and B did get the hash (somehow).
I prefer to do that without the help of any IPFS server, if possible. But if needed I have an IPFS server running (either go-ipgs or Nodejs js-ipsfs), but I don’t know how to set them up to achieve ‘sync’ between A and B.
How can I achieve this?
This is all to the best of my knowledge. You’d have to ask one of the js-ipfs developers for more recent information.
Communication between go nodes and js nodes has been buggy since forever. We finally found the bug and fixed it but this fix is only available in go-ipfs master (not yet released).
Due to this, the javascript DHT has never worked with go ipfs nodes and progress has stalled a bit (see https://github.com/ipfs/js-ipfs/pull/856). This means that content routing (the piece of IPFS that actually hunts down pieces of files) doesn’t work in javascript. Now, content fetching will work as long as you’re connected to a node that has the content, javascript nodes just won’t find nodes that have content automatically.
Until we get the DHT working in javascript, we’re working on something called delegated routing. Basically, it just asks a public gateway to find the content for you. However, this hasn’t quite landed yet.
@dryajov is this accurate?
Yes, tho I can’t speak about delegate routing much, but the rest is accurate.
1 Like
Okay. Thanx for the clarification!