[Browser] Node selection and content modification

Hi guys first of all my english is pretty basic so sorry if some sentences are not fully correctly formulated.

This post is derived from my stackoverflow question:

Searching acrross the web for a data sharing and syncing protocol p2p i’ve come across IPFS and libp2p.

What i want to build is similar to this project GitHub - jsmouret/grpc-over-webrtc: gRPC over WebRTC the idea is replace http with webrtc. And ( this is when IPFS could be used ) make use of connected clients as read replicas of the latest data ie: list of products and price, etc. The server would sign that data with his key and the clients will verify that data with the server public key.

This would be useful for offline webapps where not all the data is highly dynamic

For what i understood i would need a IPFS Cluster that replicates data between network nodes and only autorized ones with read only permissions, the server in this case the Grpc WebService would be the only one allowed to write “pin i think the action is called”.

If the data is signed by the server i wouldn’t need a private IPFS network right?
I’m i in the correct path for formulating the intended scheme?
I’m missing something?
If i want to add data syncing how much time could pass between the webservice pinning for example new product stock and clients to have the new data ?

Thanks in advance

[EDIT]
Would https…://…github.com/libp2p/js-libp2p-webrtc-direct be a better fit than star for this use case?

I don’t know about webrtc, but once an instance of IPFS publishes some new content (new CIDs) the rest of the network can see it “immediately” (only latency is how fast the server who published it can serve it up, before it starts to move out to other nodes kinda the way BitTorrent would).

So the decision is really how to ‘notify’ whoever needs to be notified once there’s updates published. You could use PubSub or any other way to signal to interested parties that new info is available, and publish (distribute) some root/level CID that points to the new index to all the new content. Then the interested parties could issue requests to get whatever CIDs they need only when they need it.

Key key point here is that merely sending out the new root CID would be the same as publishing ALL that data (logically).

I could use something like orbit-db for this use case they use pubsub over ipfs https…://github.com/orbitdb/orbit-db , may be i don’t event need an ipfs cluster at all because orbit-db only allows the db creator write access.

I would append for each webservice method the latest data signed from the server in the keyvalue store of orbit and then the clients would listen for that data.

And all the data will be only readable and verifiable from the clients that are intended to read it

Hmm may be this will be more performant over a great number of connections than Firebase Firestore just a thought.

Right, I think your ideas are good. The beauty of IPFS is of course that you can send around CIDs instead of sending actual data, and if you interface to OrbitDB instead of directly to IPFS that makes things much simpler too.