GunDB MultiSocket
Single HTTP/S
server providing WebSocket
Path based routing to ephemeral GunDB instances in mesh isolation.
Notes
- uses its own mem storage adaptor to avoid any disk writes
- uses its own websockets adaptor allowing injection into Gun contructors
- MUST be served through SSL and can easily be deployed on glitch and other platforms.
Installation
npm install
npm start
Gun WS Flow
Example
localStorage.clear();
var random1 = Math.random().toString(36).substring(7);
var gun1 = Gun({peers:["https://gundb-multiserver.glitch.me/"+random1], musticast: false, localStorage: false, radisk: false, file: false});
gun1.get('jack').put({ name: "Jack" });
// This should be triggered
gun1.get('jack').on(function(data, key){
console.log("gun 1 update:", data);
});
// This should never be triggered
gun1.get('jill').on(function(data, key){
console.log("Jack should NOT see Jill's update", data);
});
var random2 = Math.random().toString(36).substring(7);
var gun2 = Gun({peers:["https://gundb-multiserver.glitch.me/"+random2], multicast: false, localStorage: false, radisk: false, file: false});
gun2.get('jill').put({ name: "Jill"});
gun2.get('jill').on(function(data, key){
console.log("gun 2 update:", data);
});
Credits
This project is a component of Gun Meething powered by GunDB