Skip to content

[wip] feat: upgrade libp2p, apply breaking changes#2

Open
ratik21 wants to merge 5 commits intoMarcoPolo:masterfrom
ratik21:master
Open

[wip] feat: upgrade libp2p, apply breaking changes#2
ratik21 wants to merge 5 commits intoMarcoPolo:masterfrom
ratik21:master

Conversation

@ratik21
Copy link
Copy Markdown

@ratik21 ratik21 commented Sep 1, 2022

Tests are not working (trying to fix an import issue).

The code seems fine but i am still having issues (with remote yjs public docs syncing) when i am using it. Could you please review the code @MarcoPolo ? Thanks

@ratik21
Copy link
Copy Markdown
Author

ratik21 commented Sep 7, 2022

@MarcoPolo could you please review?

@MarcoPolo MarcoPolo self-requested a review September 8, 2022 05:25
Copy link
Copy Markdown
Owner

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test that fails with your changes but worked in the old version?

Comment thread package.json
"y-protocols": "^1.0.x",
"peer-id": ">=0.16.0"
"@libp2p/peer-id": "^1.1.15",
"y-protocols": "^1.0.x"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to update the peer dependency below

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will do. thanks

Comment thread src/index.test.ts
// @ts-ignore
import * as awarenessProtocol from 'y-protocols/dist/awareness.cjs'
import Libp2p from 'libp2p'
import {Libp2p as ILibp2p} from 'libp2p'
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was using libp2p class type as Libp2p (so prefixed an I). It was also giving a type error (related to namespace)

Comment thread src/index.ts
this.node.pubsub.unsubscribe(awarenessProtocolTopic(this.topic))
this.node.pubsub.removeAllListeners(awarenessProtocolTopic(this.topic))

this.node.pubsub.removeEventListener('message');
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this change in the new version of js libp2p?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants