Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: file sharing #76

Merged
merged 28 commits into from
Sep 26, 2023
Merged

feat: file sharing #76

merged 28 commits into from
Sep 26, 2023

Conversation

youngjoon-lee
Copy link
Contributor

@youngjoon-lee youngjoon-lee commented Jun 24, 2023

Closes #69

Implemented the file sharing feature using streaming protocol, as presented as my HackFS 2023 project.

In Rust, I used the request-response protocol. I've noticed that the latest rust-libp2p v0.52.0 support request-response with CBOR/JSON codec, but I didn't use it in this PR. At later PRs, we can bump rust-libp2p.

In Javascript, I used the raw streaming protocol since js-libp2p doesn't have request-repsonse protocol explicitly.

Since both rust-peer and js-peer support WebRTC, two js-peer in browser can share files between each other.

TODO: Add file-sharing for go-peer
I also implemented this feature for Go-peer.

@vercel
Copy link

vercel bot commented Jun 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
universal-connectivity ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 23, 2023 11:26am

@maschad
Copy link
Member

maschad commented Jun 28, 2023

Thanks for opening this PR, this awesome. It seems like the frontend is failing to build, could you resolve those? If you intend to add support for the go-peer as well you may want to convert this to a draft PR.

@maschad maschad self-assigned this Jun 28, 2023
@youngjoon-lee
Copy link
Contributor Author

Thanks for opening this PR, this awesome. It seems like the frontend is failing to build, could you resolve those? If you intend to add support for the go-peer as well you may want to convert this to a draft PR.

Thank you. I wanted to see CI logs but it seems I cannot because I don’t have an access to Vercel. Could you share mr which error occurred?

For Go, I’ve seen that Go peer successfully send a request to the JS peer and receive a response, but the response body was empty. I’ll convert this PR into draft and will investigate it.

@youngjoon-lee youngjoon-lee marked this pull request as draft June 28, 2023 03:05
@maschad
Copy link
Member

maschad commented Jun 28, 2023

Thank you. I wanted to see CI logs but it seems I cannot because I don’t have an access to Vercel. Could you share mr which error occurred?

Seems there was a compilation failure.

npm ERR! Lifecycle script `build` failed with error:
--
07:32:50.873 | npm ERR! Error: command failed
07:32:50.873 | npm ERR!   in workspace: universal-connectivity-browser
07:32:50.873 | npm ERR!   at location: /vercel/path0/packages/frontend
07:32:50.890 | Error: Command "npm run build" exited with 1

@youngjoon-lee
Copy link
Contributor Author

youngjoon-lee commented Jul 1, 2023

Seems there was a compilation failure.

npm ERR! Lifecycle script `build` failed with error:
--
07:32:50.873 | npm ERR! Error: command failed
07:32:50.873 | npm ERR!   in workspace: universal-connectivity-browser
07:32:50.873 | npm ERR!   at location: /vercel/path0/packages/frontend
07:32:50.890 | Error: Command "npm run build" exited with 1

@maschad I just fixed the compilation failure: 80f0963.
Also, implemented the Go peer side as well: 1eed7d5
Please review when you have time :)
Screenshot 2023-07-02 at 19 03 22

Copy link
Member

@maschad maschad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work on this! There are just a few comments.

Also I am going to ask for @TheDiscordian review for the Go aspect and @mxinden or @thomaseizinger review on this for the rust aspect.

packages/frontend/src/components/chat.tsx Outdated Show resolved Hide resolved
packages/frontend/src/components/chat.tsx Outdated Show resolved Hide resolved
packages/frontend/src/components/chat.tsx Outdated Show resolved Hide resolved
packages/frontend/src/components/chat.tsx Outdated Show resolved Hide resolved
@p-shahi
Copy link
Member

p-shahi commented Jul 5, 2023

Thank you for the awesome contribution @youngjoon-lee
I have a some questions about this being merged to main that I would like to discuss here first.
This is not intending to gatekeep this repo but decide collectively about how best we upstream new features like this. The first two questions are mainly for you:

Maintenance - are you ok with being on the hook to maintain the file transfer aspects of this app? In case a user reports an issue here, is it ok for myself or others on the team to tag you/assign issues in that domain?

Docs - I have a draft PR to add docs for this app here: libp2p/docs#331. It talks about libp2p only right now and needs to account for the chat UI etc. Would you be willing to contribute some docs on how the file transfer aspect works? i.e. For a new user, the goal is that we have docs accompanying the code so that they can follow to re-create this from scratch while understanding how things work. Note: I am happy to work with you to write these docs.

How feature rich or sparse this app should be - This is an open question to all (pinging @2color for his 2 cents as well). This chat app was written to showcase how libp2p transports and implementations interop with each other. Adding file sharing capabilities seems like the natural next step.
My question really is what's the future of the app:

  • should functionality be limited on purpose to keep the transports front and center, keep maintenance overhead low, and give new users less things to learn when copying this app

or

  • should this app be expanded where it makes sense (i.e. features like this PR or a future integration with Helia) as long as we can guarantee the new code can be maintained by contributors and we have accompanying docs for users to learn from (i.e. lower cognitive complexity for brand new users)

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust code LGTM!

rust-peer/src/main.rs Outdated Show resolved Hide resolved
rust-peer/src/protocol.rs Show resolved Hide resolved
@maschad
Copy link
Member

maschad commented Sep 21, 2023

Sorry we have taken so long to address this @youngjoon-lee I think it's good for merge given you've addressed @TheDiscordian 's comments.

Would you be able to resolve the conflicts and then we can land this?

@thomaseizinger
Copy link
Contributor

Would you be able to resolve the conflicts and then we can land this?

Given that I caused the conflicts with my other PRs, I went ahead and resolved them for you @youngjoon-lee. Couldn't push to this PR so opened one on your fork: youngjoon-lee#9

* Removed 'node' reference from main readme, trimmed down go-peer README to be more relevant to us (libp2p#75)

* chore: Update .github/workflows/stale.yml [skip ci]

* Add dependabot file (libp2p#86)

* Move `frontend` to `js-peer` for consistency (libp2p#84)

Co-authored-by: chad <chad.nehemiah94@gmail.com>

* Update Rust peer to `0.52` (libp2p#83)

---------

Co-authored-by: TheDiscordian <43145244+TheDiscordian@users.noreply.github.com>
Co-authored-by: GitHub <noreply@github.com>
Co-authored-by: chad <chad.nehemiah94@gmail.com>
@thomaseizinger
Copy link
Contributor

Huh, that diff seems odd! Something about my merging must have gone wrong, sorry about that @youngjoon-lee :(

@youngjoon-lee
Copy link
Contributor Author

Huh, that diff seems odd! Something about my merging must have gone wrong, sorry about that @youngjoon-lee :(

No worries! Let me fix it :)

@thomaseizinger
Copy link
Contributor

Huh, that diff seems odd! Something about my merging must have gone wrong, sorry about that @youngjoon-lee :(

No worries! Let me fix it :)

My guess would be that just merging again should fix it!

@youngjoon-lee
Copy link
Contributor Author

youngjoon-lee commented Sep 23, 2023

Sorry we have taken so long to address this @youngjoon-lee I think it's good for merge given you've addressed @TheDiscordian 's comments.

Would you be able to resolve the conflicts and then we can land this?

Thank you! @maschad. I resolved conflicts, with @thomaseizinger's help, and checked everything works well. Could you merge this PR if this looks good to you?

@maschad maschad merged commit 062ba90 into libp2p:main Sep 26, 2023
2 checks passed
@maschad
Copy link
Member

maschad commented Sep 26, 2023

Awesome! Thanks again @youngjoon-lee for your work here.

@youngjoon-lee
Copy link
Contributor Author

Awesome! Thanks again @youngjoon-lee for your work here.

Thank you. I'll keep maintaining this code by monitoring this repo. Please ping me whenever you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support sending files
6 participants