Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Support request-response? #8

Closed
youngjoon-lee opened this issue May 3, 2023 · 2 comments
Closed

Support request-response? #8

youngjoon-lee opened this issue May 3, 2023 · 2 comments

Comments

@youngjoon-lee
Copy link

youngjoon-lee commented May 3, 2023

Hi @vincev

Thank you for releasing this crate. I'm looking forward to seeing that this crate is included in the rust-libp2p officially soon.

I'm trying to extend your wasm-p2p-chat example to support file sharing using the request-response protocol, similar as the file-sharing example in the rust-libp2p repo.

But, it didn't work. I'd like to ask if the libp2p-websys-transport supports the request-response protocol.

In my scenario, my wasm web broadcast a start-providing via Kademlia. Then, my rust-libp2p node calls a get-providers via Kademlia and sends a file request to the my web via request-response.
My web uses your libp2p-websys-transport and my Rust node uses TCP and WebSocket transports provided by rust-libp2p.

When, my Rust node tries to send a file request to my web, the following error occurs. It seems that it was failed to upgrade the outbound connection from the node to the web.

[2023-05-03T11:35:21Z INFO  jiri_core::p2p] Sending a request to PeerId("12D3KooWEcodQSPbhaTTF9v9RSmQUTf4UY99qCcYT1SbTseE8EsT") for 6990c425-f1cf-4130-9027-8d93b9074974
[2023-05-03T11:35:21Z INFO  jiri_core::p2p] Sent request successfully
[2023-05-03T11:35:21Z DEBUG yamux::connection] 3340b205: new outbound (Stream 3340b205/6) of (Connection 3340b205 Server (streams 2))
[2023-05-03T11:35:21Z DEBUG multistream_select::dialer_select] Dialer: Proposed protocol: /jiri-file-exchange/1
[2023-05-03T11:35:21Z DEBUG multistream_select::dialer_select] Dialer: Received confirmation for protocol: /jiri-file-exchange/1
[2023-05-03T11:35:21Z DEBUG libp2p_core::upgrade::apply] Failed to upgrade outbound stream to /jiri-file-exchange/1
[2023-05-03T11:35:21Z DEBUG libp2p_swarm] Connection closed with error Handler(Left(Left(Left(Right(Upgrade(Apply(Kind(UnexpectedEof)))))))): Connected { endpoint: Listener { local_addr: "/ip4/172.30.1.25/tcp/8081/ws", send_back_addr: "/ip4/172.30.1.25/tcp/57019/ws" }, peer_id: PeerId("12D3KooWEcodQSPbhaTTF9v9RSmQUTf4UY99qCcYT1SbTseE8EsT") }; Total (peer): 0.
[2023-05-03T11:35:21Z DEBUG libp2p_gossipsub::behaviour] Peer disconnected: 12D3KooWEcodQSPbhaTTF9v9RSmQUTf4UY99qCcYT1SbTseE8EsT
[2023-05-03T11:35:21Z INFO  jiri_core::p2p] Unrecognized event received: JiriBehaviourEvent: OutboundFailure { peer: PeerId("12D3KooWEcodQSPbhaTTF9v9RSmQUTf4UY99qCcYT1SbTseE8EsT"), request_id: RequestId(1), error: ConnectionClosed }

Do you have any idea about the request-response support? I'm curious if I have to use other ways, such as WebRTC or relay-server.
Thank you!

@vincev
Copy link
Owner

vincev commented May 3, 2023

Hi @youngjoon-lee,

I have never tested this transport with anything more complex than a chat but Thomas from the libp2p team who is improving the code to bring the crate into libp2p found a problem with Websocket dropping connection if the client sends a lot of data (see here).

It seems that the problem you are getting may be caused by the connection being dropped.

@youngjoon-lee
Copy link
Author

Thank you @vincev for your help. I'm just sending only 20 bytes of data from server to the wasm web, but I'll try to read the thread that you shared carefully. Also, I'll try to test it with the existing libp2p-wasm-ext.

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

No branches or pull requests

2 participants