-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
src/core/components/init.js
Outdated
@@ -45,6 +46,12 @@ module.exports = function init (self) { | |||
opts.log('done') | |||
opts.log('peer identity: ' + config.Identity.PeerID) | |||
|
|||
if (webrtcSupport.support || isNode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isNode does not gurantee webrtc support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try {
require('webrtc')
} catch () {
console.log('sad')
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean wrtc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we do
Reviewing this, the hard case is when a user wants to say "no I don't want WebRTC". On a second thought, we actually can just make it part of the default multiaddrs, swarm will know how to handle non existing transports for multiaddrs to listen. This is a far simpler solution and it makes total sense with the new init \o/ |
154822b
to
5e0123b
Compare
All right, this is ready :) |
Travis fails due to #844, not related with this PR |
Ok, after experimenting a bit with it in Linux, I believe I found a more sane approach until we have a WebRTC transport that is rock solid in Linux and Windows. @victorbjelkholm and all the Linux users of js-ipfs, mind giving your feedback on: |
Not a big fan of turning off webrtc for linux users, but since it's not stable enough, this is probably the best way to go about it. However, if I specify a libp2p-webrtc-star address in my own swarm config, and don't set If I don't, I agree we shouldn't automatically add it. |
Ah, maybe include that you can use |
From what I can read from your second point, it matches what is happening
Yeah, agree with you, wish there was a good WebRTC implementation. |
@diasdavid hm, you're thinking about the CLI, and I think in that case, it makes sense. However, when using it in code, the usage becomes a lot harder if I can't just specify it in my swarm addresses and it sticks. If instead, I need to run through the normal startup, then once it's I'm want this (https://github.com/VictorBjelkholm/js-ipfs-in-the-browser/blob/master/spawn-node.js#L14-L20) to still work the same way as before, even for Linux users, since the Swarm addresses are manually specified. |
In the browser, you won't have to do anything, since browser is not a linux or windows env In Node.js, using it programmatically, you just need to set You will continue to be able to do -- https://github.com/VictorBjelkholm/js-ipfs-in-the-browser/blob/master/spawn-node.js#L14-L20 -- as before |
@diasdavid ay, of course! Duh. Still, if it was a script executed by nodejs, even if I explicitly set swarm address and not specify |
@victorbjelkholm yes, but then you just set that environment flag and you are golden. Another thing we can add is an EXPERIMENTAL flag for "WRTC_LINUX_WINDOWS" so that you can pass that instead of having to do the And yes, I agree if we add that experimental flag, it should be named the same. |
Yeah... My point is, if I explicitly set something in the config and run the script, I don't assume js-ipfs to make a choice for me. If I set those addresses explicitly, it's not my expectation that those will be removed automatically unless I set a env var. However, if I don't specify them, it would make sense that we don't add them. |
I see a bunch of The case you talk about is for the user that needs to go through all the trouble of downloading and building wrtc by hand for Linux, at that state he will be more than familiar with the README and the case. For all the other users, it will work. |
In go we try to prefix IPFS flags with |
@@ -2,7 +2,8 @@ | |||
"Addresses": { | |||
"Swarm": [ | |||
"/ip4/0.0.0.0/tcp/4002", | |||
"/ip4/127.0.0.1/tcp/4003/ws" | |||
"/ip4/127.0.0.1/tcp/4003/ws", | |||
"/libp2p-webrtc-star/dns4/star-signal.cloud.ipfs.team/wss" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is swarm listen address list. Sure it should be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep @Kubuxu, WebRTC references the signalling point, not a local server ;)
good point @Kubuxu! changed the name of the env flag to be prefixed by |
0dae64c
to
ea16621
Compare
ea16621
to
4ea1571
Compare
I want to add this in, but cope with the scenarios where there is no webrtc-support. The current way does it, but also it makes it annoying to disable webrtc only, you'd have to swap all the multiaddrs at the same time to stop supporting webrtc. Will look into a better way.