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

what is an upgrader? #218

Closed
Deepp0925 opened this issue Apr 30, 2020 · 7 comments
Closed

what is an upgrader? #218

Deepp0925 opened this issue Apr 30, 2020 · 7 comments

Comments

@Deepp0925
Copy link

Deepp0925 commented Apr 30, 2020

how to create one?

  • I already checked the interface-transport
@vasco-santos
Copy link
Member

Hey @Deepp0925

An upgrader takes a raw connection (obtained from a specific transport, webrtc in this case) and upgrades it into a libp2p connection. This is, it encrypts the connection and multiplex it, according to the connection encryptor mechanism and multiplexer provided by js-libp2p: https://github.com/libp2p/js-libp2p/blob/master/src/upgrader.js

I agree that this should be detailed in the interface-transport! Would you like to try to PR it with this information? Otherwise, I can add it to my list

@daviddahl
Copy link

daviddahl commented May 28, 2020

I found it difficult to provide the correct upgrader object expected by the wrtc constructor. The exception links to a deprecated repo, and the Upgradertests in libp2p do not seem all that clear to me. I am looking to use libp2p-webrtc-star/src/sig-server as a signaling server for a pubsub app and cannot get past this exception requiring an upgrader. It seems like the upgrader needs access to the peerInfo object, but peerInfo is not constructed at the point that one needs to pass in the upgrader.

I thought I found the answer in this excellent code: https://github.com/libp2p/js-libp2p-examples/tree/master/chat - but then realized it is and older, deprecated version of libp2p. It would be very cool to see this code updated to work with the latest libp2p.

I have scoured the libp2p repos for examples of a real Upgrader in the wild, I have so far just found tests and mockUpgraders that just return the same multiaddress? for both upgradeInbound/Outbound methods.

Any pointers would be greatly appreciated.

Edit: All of my expected peers are running in node,js, not browser.

@daviddahl
Copy link

I have created a PR to my own fork of js-ipfs with an attempt of using an upgrader and wrtc for signalling, here: daviddahl/js-ipfs#1

@vasco-santos
Copy link
Member

@daviddahl

I thought I found the answer in this excellent code: https://github.com/libp2p/js-libp2p-examples/tree/master/chat - but then realized it is and older, deprecated version of libp2p. It would be very cool to see this code updated to work with the latest libp2p.

This is from an old workshop, but we should check on updating it!

Any pointers would be greatly appreciated.

js-libp2p should allow setting up a custom upgrader. I would recommend that you open an issue in js-libp2p where we can discuss on the best approaches for this and also create an example for these use cases.

@daviddahl
Copy link

@vasco-santos

js-libp2p should allow setting up a custom upgrader. I would recommend that you open an issue in js-libp2p where we can discuss on the best approaches for this and also create an example for these use cases.

Will do. Thank you.

@autonome
Copy link

Is there a doc change required here @vasco-santos, or can be closed?

@daviddahl were you able to get the upgrader working?

@vasco-santos
Copy link
Member

We should probably improve our description about the libp2p upgrader in https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/transport#upgrader.

I am closing this issue and opening a new one in the interfaces repo

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants