Retrieve raw WebRTC connection from JS-IPFS object

Is this possible to retrieve the raw WebRTCPeerConnection objects from the Javascript IPFS object? Because, I haven’t seen any way to communicate directly with peers we are connected to with JS-IPFS (sorry I haven’t used the library much). And even if there is a way, I assume there is a bandwidth overhead (even if it small) from using the IPFS wrapper instead of the raw WebRTC connection.

I would like to develop an online web game, where every peer would transmit their movements over the network. So I want to minimize the latency and maximize the throughput, hence my question.

We have had some discussions about this. There is this discussed solution: [Feature Request] Expose custom transport data streams · Issue #838 · libp2p/js-libp2p · GitHub and some PRs from @HexaField like feat: add raw connection and transport tag to Connection interface by HexaField · Pull Request #79 · libp2p/js-libp2p-interfaces · GitHub which will need to be updated

1 Like

Thanks! So if the PR has been accepted, where can we find a quick how-to for retrieving the raw connection from the IPFS (or libp2p) object?

In each connection. You can both go to libp2p.connectionManager.getAll() or, listen for connection events js-libp2p/API.md at master · libp2p/js-libp2p · GitHub

The PRs need to be updated according to the solution specified in the issue.

1 Like