How would live updates work on the safenetwork?


#1

Will you be using websockets or something like that?

On a similar note, would there be any benefit of using gun.js on the Safenetwork? I was messing around with gun.js a while ago. It’s a tiny (but very cool) real-time P2P graph database engine written in Javascript, which uses localstorage (and other storage options). It’s eventually consistent and resolves conflicts using string comparison. It’s really easy to install (just add one js file to index.html) and the syntax is similar to firebase. I was thinking it could be used for things like real-time chat apps, as having to throw safecoin at every PUT request could stifle the banter. Can anyone see any advantages of using this?


#2

Nice, did not know about gun.js thanks for sharing. I will probably use it for non safenet game, it seems to solve easily sync problem I had.


#3

Yeh it’s pretty cool. I was just looking at this real-time chat app made using gun.js on codepen. Might be a good reference :wink:


#4

WebSockets are client-server, so I don’t think this is something that will be naturally supported on SAFE.

I can’t figure out how GUN is P2P; how can a browser communicate with another browser? It seems GUN requires a server, so no P2P?


Anyway, this is a great question, but I think this is not a priority for MaidSafe until much later.


#5

I’m not sure exactly how gundb works under the hood. This is from the docs…

GUN is fully decentralized (peer-to-peer or multi-master), meaning that changes are not controlled by a centralized server. A server can be just another peer in the network, one that may have more reliable resources than a browser. You save data on one machine, and it will sync it to other peers without needing a complex consensus protocol. It just works.


#6

Doesn’t seem like something that can easily port to SAFE without a fair degree of customization. Peers seem to be other browsers, but seem to still communicate to larger servers, unless I misunderstand from their descriptions.

But still would be very cool to have that minimal chat app you linked to running on SAFE (below):