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

Add web client using WebSocket #4

Closed
youngjoon-lee opened this issue May 1, 2023 · 1 comment · Fixed by #5
Closed

Add web client using WebSocket #4

youngjoon-lee opened this issue May 1, 2023 · 1 comment · Fixed by #5
Assignees

Comments

@youngjoon-lee
Copy link
Owner

youngjoon-lee commented May 1, 2023

There are many ways to build web clients as mentioned in https://connectivity.libp2p.io.
At the beginning, I wanted to build an web client using WebRTC that is supported by rust-libp2p.

But, I've found an easier example: https://github.com/vincev/wasm-p2p-chat based on WebSocket (better supported by rust-libp2p currently, compared to WebRTC), which is based on https://github.com/vincev/libp2p-websys-transport (written by the same author with the websocket example). This libp2p-websys-transport will replace the official libp2p-wasm-ext in the rust-libp2p by the libp2p team: libp2p/rust-libp2p#3611. So, it would be worth investigating this way for now.

After getting familiar with this websocket way, I'll try to use WebRTC as well.

@youngjoon-lee youngjoon-lee self-assigned this May 1, 2023
@youngjoon-lee
Copy link
Owner Author

youngjoon-lee commented May 1, 2023

We cannot proceed because libp2p-gossipsub isn't compiled for wasm-unknown-unknown, as mentioned in https://github.com/mriise/libp2p-wasm-chat/blob/4417083a7a1a3ed4ddcfe33d4f5fa6bb64d25c04/Cargo.toml#L32.

error[E0432]: unresolved import `libp2p::gossipsub`
  --> jiri-web/src/main.rs:11:5
   |
11 |     gossipsub, identity, noise,
   |     ^^^^^^^^^ no `gossipsub` in the root

That was why the https://github.com/vincev/wasm-p2p-chat was written using only floodsub, not gossipsub.

I also tried to build https://github.com/mriise/libp2p-wasm-chat that supports gossipsub by using the local clone of rust-libp2p as an workaround for wasm-unknown-unknown. But it wasn't compiled well, as complained in mriise/libp2p-wasm-chat#1.

I guess that this issue will be resolved by libp2p/rust-libp2p#2653, because I've got a wasm-timer related error when referring to the local clone of libp2p-gossipsub, as mentioned in https://github.com/mriise/libp2p-wasm-chat/blob/4417083a7a1a3ed4ddcfe33d4f5fa6bb64d25c04/Cargo.toml#L32.

All of these efforts have been commited in the client branch.

youngjoon-lee added a commit that referenced this issue May 1, 2023
Unfortunately, libp2p-gossipsub doesn't support WASM well currently.
That's why I used libp2p-floodsub instead. For more details, please see #4 (comment)
@youngjoon-lee youngjoon-lee linked a pull request May 1, 2023 that will close this issue
youngjoon-lee added a commit that referenced this issue May 1, 2023
Unfortunately, libp2p-gossipsub doesn't support WASM well currently. That's why I used libp2p-floodsub instead. For more details, please see #4 (comment)
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 a pull request may close this issue.

1 participant