libp2p/docs

js-libp2p ping-pong - TypeError: node.ping is not a function

stefan1010 opened this issue · 7 comments

Receiving: TypeError: node.ping is not a function

Running on:
"dependencies": { "@chainsafe/libp2p-noise": "^12.0.0", "@libp2p/mplex": "^8.0.3", "@libp2p/tcp": "^7.0.1", "libp2p": "^0.45.1", "multiaddr": "^10.0.1" }

Maybe implementation has changed?

Correct we recently integrated the use of optional services, and so the ping method is on the PingService.

Thanks for catching this! We do need to update the getting started docs. Would you be able to open a PR?

Would love to, but from the docs I can't figure out how to use the PingService.

From configuring it as a service on the node, I would expect it to be callable from node.services.ping. But that gives me ..not a function as well.

Not configuring it and directly calling pingService(ma) is the only working solution I found, but it's not a method on the pingService as you mentioned, so this is confusing me. I also don't see a way to get the latency, as it is part of the getting started docs.

I would need to see your configuration but here's an example of how it's called on the ping service i.e. essentially node.services.ping.ping(ma) . I hope that clears things up.

Receiving 403 permission denied when I try to push my branch.

Sorry, I dont know how to create the PR. Would be my first one on github.

Sure no worries, you may want to read through the Github docs on creating a pull request. Once you've done that then I would suggest taking a look at our section on contributing content

Opened this PR:
#325

Not sure how to link it to this issue.
Not sure if the PR follows any given conventions.
Any hints and advice appreciated.

Thanks for this PR. You can get more info on how to link docs here I left some comments on the PR.