Skip to content
This repository was archived by the owner on Apr 24, 2023. It is now read-only.

Connecting with go-libp2p node via go-libp2p-webrtc-direct transport #127

Open
tchardin opened this issue Jul 7, 2021 · 6 comments
Open
Labels
help wanted Seeking public contribution on this issue need/analysis Needs further analysis before proceeding

Comments

@tchardin
Copy link

tchardin commented Jul 7, 2021

Hello, was wondering if connecting to https://github.com/libp2p/go-libp2p-webrtc-direct was expected to work with this transport. I tried opening a stream, the connection seems to be established as the libp2p.on('peer:discovery') event is triggered when dialing the p2p-webrtc-direct address but then I see an error in the console:

AggregateError: 
    TypeError: buf.get is not a function
        at _callee$ (multistream.js:22)
        at tryCatch (runtime.js:63)
        at Generator.invoke [as _invoke] (runtime.js:293)
        at Generator.next (runtime.js:118)
        at asyncGeneratorStep (asyncToGenerator.js:3)
        at _next (asyncToGenerator.js:25)
    at maybeSettle (index.js:31)
    at _callee$ (index.js:69)
    at tryCatch (runtime.js:63)
    at Generator.invoke [as _invoke] (runtime.js:293)
    at Generator.throw (runtime.js:118)
    at asyncGeneratorStep (asyncToGenerator.js:3)
    at _throw (asyncToGenerator.js:29)

My code is the basic echo example from the go-libp2p-webrtc-direct and on the JS side:

 const {stream} = await node.dialProtocol(peerId, ECHO_PROTOCOL);
 await pipe(['Hello world!'], stream, async function (source: Uint8Array[]) {
        // For each chunk of data
        for await (const data of source) {
          // Output the data
          console.log('received echo:', data.toString());
        }
 });

The handler on the go side doesn't register the message. Curious if I might be missing something or if more work is needed for compatibility with https://github.com/pion/webrtc.

Thanks!

@daviddias
Copy link
Member

@vasco-santos can you look into this one?

@vasco-santos
Copy link
Member

vasco-santos commented Jul 11, 2021

Thanks for reaching out @tchardin

I am not sure about the state of go-libp2p-webrtc. I see there is an example in the go-libp2p-webrtc side of things, but it seems to use an older version of this module. Important pointing out that this example uses an older version of this module (and the usage README here is also outdated..).

@tchardin would you ming providing us a reproducible repo with your setup for both go and js to better try to replicate the issue? Did you try just establishing a connection ( const conn = await node.dial(peerId))? did it work?

@yusefnapora given you will be working on maintenance stuff this week, can you try this out?

@tchardin
Copy link
Author

Thanks for your reply @vasco-santos!
I get the same error when dialing the peer directly. Here is a repo with the go and js code I am using:

@yusefnapora
Copy link

Thanks for the repo @tchardin! I'll check it out today and see if I can figure out what's going on.

@lidel lidel added help wanted Seeking public contribution on this issue need/analysis Needs further analysis before proceeding labels Jul 30, 2021
@lidel
Copy link
Member

lidel commented Jul 30, 2021

@yusefnapora did you manage to look at this?

If not, someone else with free bandwidth can pick this up, but note that libp2p-webrtc-direct modules are not used by default and considered alpha, so low on maintenance priority list.

@yusefnapora
Copy link

Sorry about the delayed response. I did try to get the two implementations to speak to each other but was unable to make progress.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Seeking public contribution on this issue need/analysis Needs further analysis before proceeding
Projects
None yet
Development

No branches or pull requests

5 participants