Skip to content
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

Sync db via ipfs pubsub #19

Merged
merged 4 commits into from Oct 9, 2017
Merged

Sync db via ipfs pubsub #19

merged 4 commits into from Oct 9, 2017

Conversation

AquiGorka
Copy link
Contributor

@AquiGorka AquiGorka commented Oct 5, 2017

Ref: #25

This is a very simple implementation that we can use as base to improve.

This listens to updates from any client and updates local data with anything sent to it via the update.
It does not solve conflicts, it does not check anything.

Data is updated via p2p! Yay!

@chadoh
Copy link
Contributor

chadoh commented Oct 6, 2017

Following the pattern I set up in #18, I made Database responsible for doing the room-setup and broadcasting.

@AquiGorka
Copy link
Contributor Author

This looks interesting: mafintosh/hyperlog#17

@AquiGorka
Copy link
Contributor Author

AquiGorka commented Oct 6, 2017

I have been having difficulties making this work like yesterday; some researching led me to find that ipfs.pubsub uses a signaling server (libp2p-webrtc-star) - and as it should not be used in production, it may have some restrictions.

I am looking into running our own server to see if this helps with pubsub working too.

if (this.ipfsNode) resolve(this._nodeInfo())
if (this.ipfsNode) {
resolve(this._nodeInfo())
return
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, good call. What happens if we put this all on the same line?

if (this.ipfsNode) return resolve(this._nodeInfo())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure. It returns the return value from the resolve method (another promise?), if we are dismissing it then this doesn't really matter. Go ahead if you'd rather have it that way.

@chadoh
Copy link
Contributor

chadoh commented Oct 6, 2017

I have been having difficulties making this work like yesterday

Is this due to my changes?

@AquiGorka
Copy link
Contributor Author

AquiGorka commented Oct 6, 2017

No, no, your changes are awesome, thank you for adding structure to my hackish coding, I'm more focused on making things work and I am leaving best practices for later. I think signaling servers have connectivity restrictions, which is why I considered running our own but I still have no proof to that statement - I'll keep researching.

@AquiGorka
Copy link
Contributor Author

AquiGorka commented Oct 9, 2017

This is working as I originally developed it. I added a first commit with vanilla IPFS pubsub and then added the room abstraction which adds a couple of events that I use to send data to new peers.

@chadoh chadoh changed the base branch from feature/ipfs-store-retrieve to master October 9, 2017 15:42
@chadoh
Copy link
Contributor

chadoh commented Oct 9, 2017

Looks great! I added one small missing thing. Merging!

@chadoh chadoh merged commit 377b904 into master Oct 9, 2017
@chadoh chadoh deleted the feature/ipfs-pubsub branch October 9, 2017 16:05
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.

None yet

2 participants