I am interested in decentralized systems, and am currently considering building one myself. I am considering using JavaScript and HTML5, simply because it makes it very easy to use the system (they just have to go to a website).
Some thoughts:
- I may or may not use another decentralized network for storage, and even if I do, I probably want to cache stuff on the client. If I do not, I need to store stuff on the client, since the information will then be distributed on my network. Is any of the HTML5 storage models good for this? I’ve read somewhere that they have a size limit.
- When using JavaScript in the browser, my understanding is that I have to use WebSockets instead of regular sockets. Doesn’t this force me to use WebSocket in my “protocol spec”?
2
If I do not, I need to store stuff on the client, since the
information will then be distributed on my network. Is any of the
HTML5 storage models good for this? I’ve read somewhere that they have
a size limit.
The only way I know how to distribute data in your scenario is with a web server component. If you want to store your data client side only ( via HTML5 local storage, webSQL, or indexedDB) you could implement a http://en.wikipedia.org/wiki/Gossip_protocol on the web server, to reflect all data communicated from clients to each other.
When using JavaScript in the browser, my understanding is that I have
to use WebSockets instead of regular sockets. Doesn’t this force me to
use WebSocket in my “protocol spec”?
You don’t have to use Websockets. You could accomplish this with ajax and polling. Websockets however does enable you to easily push data from the server
to the client, so it would make the implementation of your gossip protocol easier. One client posts a message that they have saved locally, and your Websockets enabled web server relays the message to all other clients, who then store the data locally.
Recommendations:
– if you want to use JavaScript across the board, try Node.js and the SocketIO library
– if you want to not have to write the server component, you could try something like https://www.firebase.com/
As for local storage, from html5 rocks: ““5 megabytes” is how much storage space each origin gets by default. This is surprisingly consistent across browsers, although it is phrased as no more than a suggestion in the HTML5 Storage specification.”