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

fix: add browser-to-browser test for bi-directional communication #172

Merged
merged 2 commits into from
Jun 12, 2023

Conversation

Marcel-G
Copy link
Contributor

@Marcel-G Marcel-G commented Jun 1, 2023

Fixes: #173

Before this change, connecting to a webRTC peer over a relay would result in two open connections to the peer. One private-to-private webRTC connection and one relayed connection (used for signalling).

In the browser-to-browser example, dialling B -> A simply returns the first existing connection to A (Added when dialling A -> B). The first connection is not the webRTC connection but rather the relayed connection. This causes the echo to break after the relay is closed or after the reservation expires.

After signalling is complete, the relayed peer connection is no longer needed and can be closed. The connection to the peer is exclusively webRTC at this point.

@Marcel-G Marcel-G force-pushed the test/bidirectional-browser-to-browser branch from 2bc45b9 to 8bbd56a Compare June 1, 2023 10:37
@Marcel-G Marcel-G force-pushed the test/bidirectional-browser-to-browser branch 3 times, most recently from 80b4af8 to 85567a5 Compare June 10, 2023 14:27
Fixes: libp2p#173

Before this change, connecting to a webRTC peer over a relay would result in two open connections to the peer. One private-to-private webRTC connection and one relayed connection (used for signalling).

In the browser-to-browser example, dialling B -> A simply returns the first existing connection to A (Added when dialling A -> B). The first connection is not the webRTC connection but rather the relayed connection. This causes the echo to break after the relay is closed or after the reservation expires.

After signalling is complete, the relayed peer connection is no longer needed and can be closed. The only connection to the peer is webRTC at this point.
@Marcel-G Marcel-G force-pushed the test/bidirectional-browser-to-browser branch from 85567a5 to 6a545b7 Compare June 10, 2023 14:40
@Marcel-G Marcel-G changed the title test: add browser-to-browser test for bi-directional communication fix: add browser-to-browser test for bi-directional communication Jun 10, 2023
@Marcel-G Marcel-G marked this pull request as ready for review June 10, 2023 14:41
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.

Thanks for catching this! LGTM

@maschad maschad merged commit 1ec3d8a into libp2p:main Jun 12, 2023
github-actions bot pushed a commit that referenced this pull request Jun 12, 2023
## [2.0.10](v2.0.9...v2.0.10) (2023-06-12)

### Bug Fixes

* add browser-to-browser test for bi-directional communication ([#172](#172)) ([1ec3d8a](1ec3d8a))
@github-actions
Copy link

🎉 This PR is included in version 2.0.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Marcel-G Marcel-G deleted the test/bidirectional-browser-to-browser branch June 13, 2023 12:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

browser-to-browser example only works in one direction
2 participants