-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Node.js peer? #214
Comments
It's really straightforward but probably not in scope for this project because a lot of what this does, doesn't make any sense at all in a server only context. For instance, the WebRTC stuff is a monkey patch on top of NodeJS and what are you going to stream from a server over WebRTC that wouldn't be better done as a relay? The other issue is hosting. For a full-on server implementation, you're going to need a long-running server with a plethora of ports exposed. Most hosting environments will intentionally limit you to what ports you can expose and manually punching that many holes in their firewall is likely to get you denied. What you could do is run a circuit relay in node. The project could really use more of those they're the backbone of the p2p network.
That's it! That's all there is to it, |
I'm not sure I agree. The point here is to show that Node.js can make and accept server-style connections to go and rust peers via TCP, initiate direct connections to browsers via WebRTC (go and rust cannot do this at the time of writing, they have to dial a browser via Circuit Relay, then hope it dials them back via the unilateral connection upgrade part of DCUtR), but also accept connections from browsers via WebRTC-Direct and WebSockets. Since this project is the starting point for a lot of people, it makes sense to show what connectivity is available in which environments and Node.js is missing here currently.
Circuit Relay v2 streams are strictly time and data limited - once you hit those limits the server will close the connection abruptly so they're not really suited for application use. Instead they should be used to obtain metadata about a peer via Identify and/or to open a direct connection.
I don't follow the logic here. If you run a TCP listener on a platform without That said, the WebRTC-Direct transport multiplexes a single UDP port to allow running multiple connections concurrently. If this is actually a problem, I'm sure we can enable the regular WebRTC transport to use port muxing too in order to solve it.
The suggested configuration creates a that's only capable of dialling an existing relay, and even then it's missing the additional transport (and maybe muxer/encrypter) needed to run the Circuit Relay protocol over. See Set up a relay node from the js-libp2p Circuit Relay example for more. |
Hello @achingbrain , As gist of the required implementations, Node.js peer should demonstrate:
Shall I start with setting up relay node, listener and dial, chat streams as given here https://github.com/libp2p/js-libp2p-examples/tree/main/examples/js-libp2p-example-chat I will study further and dive into the complexities. |
Thanks! This should be "WebRTC, WebRTC Direct and WebSocket listeners for browser connections" and "WebRTC dialing to browsers" (not WebRTC Direct). If you are not clear on the difference between WebRTC and WebRTC Direct in libp2p, the differences are described in the spec. |
sure, thank you. |
Hey @achingbrain , |
The only JS version here runs on a web page.
There should be a Node.js version that shows how to do the server-side version.
The text was updated successfully, but these errors were encountered: