Closed BartKnucle closed 5 years ago
Changed the branche to windows for more clarity
Thanks @BartKnucle. I tried to get this working on Windows, but I'm afraid that Windows is out of my ken, and it took me thirty minutes of work installing various programs to realize that even if I did get your PR downloaded on my machine, I'm not entirely sure that I could adequately test your PR.
So, to try another tack; Looking at the path documentation, Node should automatically take into account Windows paths. See here. Do you know why this PR is necessary, given that?
Hello @RichardLitt,
The problem with path.join under my setup (Win10) is that it construct the path with backslash. Ex:
"\ipfs-pubsub-direct-channel\v1\QmUFSH8QBmwbrnEGtz8Sp5pqVKCYD76MPwizr2r443KxkN\QmbbL2t5ojqQTXtkAWarLdK3WaNdVWvpVMWsop4MfV1jkY"
But under linux or in the browser, the construction is with forward slash Ex:
/ipfs-pubsub-direct-channel/v1/QmUFSH8QBmwbrnEGtz8Sp5pqVKCYD76MPwizr2r443KxkN/QmbbL2t5ojqQTXtkAWarLdK3WaNdVWvpVMWsop4MfV1jkY
For the pubsub 1on1, it implies that the browser can't reach the win10 channel.
And more globaly on orbitdb, since the database hash construction is dependent on the path, for the sames database parameters entry we have different database hash.
I think we should have a call to move forward on the windows implementation. The modified source code works very well on my windows setup and it can communicate also well with the linux and browser setup.
To go a little further, I tested the path.normalize() function, same problem and also tried to set path.sep='/' manually before the path.join(), I also have the same issue. I really think we should avoid the path.join and use the array join function to construct multiplatform paths.
Thanks @BartKnucle, sounds like a good approach 👍
FYI, fixed the code so that the /
between protocol version and the peer ID remains, fixed it in this commit to master https://github.com/ipfs-shipyard/ipfs-pubsub-1on1/commit/1671eeee18a33b3afda09fadc9044ab489cc1e4e#diff-d17c447bfb7dec05f2c5e09cd23487f9R76. Publishing to npm as 0.0.4
.
Sorry not 0.0.04, published as 0.0.5
this._id` = '/' + PROTOCOL + '/' + this._peers.join('/')
is my latest version, remove the unnecesseray ''
Removed in https://github.com/ipfs-shipyard/ipfs-pubsub-1on1/commit/40dd26986b6a94a9ca90fbaac797b4cfe6153e54. Thanks @BartKnucle, good catch 👍
Ah... I get it now. Thanks, @BartKnucle!
Path.join is plateform dependant. Resolve the connections issues from windows