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

how to use websockets transport in ipfs? #729

Closed
dryajov opened this issue Jan 27, 2017 · 6 comments
Closed

how to use websockets transport in ipfs? #729

dryajov opened this issue Jan 27, 2017 · 6 comments
Labels
kind/support A question or request for support

Comments

@dryajov
Copy link
Member

dryajov commented Jan 27, 2017

Since WebRTC is no available in Web/Service Workers (w3c/webrtc-pc#230), for now the only other option is to use WebSockets. I haven't been able to find the correct multiaddress format/string to connect to IPFS node over WS and I'm probably missing a bunch of other things. Can someone provide an example/steps of how to connect to IPFS over WS?

This is part of the #127 effort as well as overall support of Web/Service Workers #725

@daviddias
Copy link
Member

In a browser node, you don't have to add a WebSockets addr in order to be able to dial to a node with WebSockets.

In a Node.js node, you need to add that to your config, see:

https://github.com/ipfs/js-ipfs/blob/master/test/utils/temp-node.js#L11-L28

Or simply open the ~/.jsipfs/config file and add it directly. It looks the same as a tcp, but with the /ws appended

@dryajov
Copy link
Member Author

dryajov commented Jan 28, 2017

@diasdavid Thanks, will try this as soon as I get all the issues with running inside a WW ironed out.

@daviddias daviddias added the kind/support A question or request for support label Jan 29, 2017
@daviddias
Copy link
Member

Thank you @dryajov.

Also, would you like to help us with documenting this details?

@daviddias daviddias added the status/deferred Conscious decision to pause or backlog label Jan 29, 2017
@dryajov
Copy link
Member Author

dryajov commented Jan 29, 2017

Sure! Let me know how you'd like to do that.

My current plan to move forward with #725 is to replace window with self and update the project the run the WW tests. I was gonna create a PR for each project as I go.

But if you referring merely to document this use case in particular, let me know where that should be done.

Regardless, I'm here to help as much as I can :)

@daviddias
Copy link
Member

woa, thank you! glad to have you around!

I feel that the best way for now (until all of this primitives are common language to everyone) is that we have a mention on the README under the USAGE section, probably IPFS Core - https://github.com/ipfs/js-ipfs#ipfs-core-examples-use-ipfs-as-a-module and then a quick example of how that is achieve in the examples folder.

@daviddias
Copy link
Member

I believe this is now answered, let me know if this is not the case.

Also, with the new init setup, it is 100x simpler to add that websockets addr:
https://github.com/ipfs/js-ipfs#advanced-options-when-creating-an-ipfs-node

Note: today, by default, js-ipfs ships with a websockets multiaddr, so you don't even have to add one :)

@daviddias daviddias removed the status/deferred Conscious decision to pause or backlog label Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

2 participants