Update README.md
Showing
1 changed file
with
33 additions
and
1 deletions
1 | # GunDB MultiSocket | 1 | # GunDB MultiSocket |
2 | Single `HTTP/S` server providing `WebSocket` Path based routing to ephemeral [GunDB](https://gun.eco) instances for mesh isolation. | 2 | Single `HTTP/S` server providing `WebSocket` Path based routing to ephemeral [GunDB](https://gun.eco) instances for mesh isolation. |
3 | 3 | ||
4 | ### Gun WS Flow | 4 | ### Notes |
5 | * The service MUST be served through SSL and can be deployed on [glitch](https://glitch.com/~gundb-multiserver) and other platforms. | ||
6 | |||
7 | ### Installation | ||
8 | ``` | ||
9 | npm install | ||
10 | npm start | ||
11 | ``` | ||
12 | |||
13 | #### Gun WS Flow | ||
5 | 14 | ||
6 | <img src="https://user-images.githubusercontent.com/1423657/79556065-d4b55e00-80a0-11ea-8a6a-b85aa0c90cf0.png" width=500/> | 15 | <img src="https://user-images.githubusercontent.com/1423657/79556065-d4b55e00-80a0-11ea-8a6a-b85aa0c90cf0.png" width=500/> |
7 | 16 | ||
17 | #### Example | ||
18 | ``` | ||
19 | localStorage.clear(); | ||
20 | |||
21 | var random1 = Math.random().toString(36).substring(7); | ||
22 | var gun1 = Gun({peers:["https://gundb-multiserver.glitch.me/"+random1], musticast: false, localStorage: false, radisk: false, file: false}); | ||
23 | gun1.get('zero1').put({ name: "Jack" }); | ||
24 | // This should be triggered | ||
25 | gun1.get('zero1').on(function(data, key){ | ||
26 | console.log("gun 1 update:", data); | ||
27 | }); | ||
28 | // This should never be triggered | ||
29 | gun1.get('zero2').on(function(data, key){ | ||
30 | console.log("gun 1-2 update:", data); | ||
31 | }); | ||
32 | |||
33 | var random2 = Math.random().toString(36).substring(7); | ||
34 | var gun2 = Gun({peers:["https://gundb-multiserver.glitch.me/"+random2], multicast: false, localStorage: false, radisk: false, file: false}); | ||
35 | gun2.get('zero2').put({ name: "Jill"}); | ||
36 | gun2.get('zero2').on(function(data, key){ | ||
37 | console.log("gun 2 update:", data); | ||
38 | }); | ||
39 | ``` | ||
8 | 40 | ||
9 | ###### Credits | 41 | ###### Credits |
10 | This project is a component of [Gun Meething](https://github.com/meething/webrtc-gun) powered by [GunDB](https://gun.eco) | 42 | This project is a component of [Gun Meething](https://github.com/meething/webrtc-gun) powered by [GunDB](https://gun.eco) | ... | ... |
-
Please register or sign in to post a comment