-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AXE - peer/soul subscribe. In this version the peers receive only dat…
…a subscribed with gun.get(...soul...).once(...) TODO: 1) if the peer change the id, will lost the subscribes. Workaround for this is set the pid (unique) in: Gun(pid: 'mypeerid', peers:[...]) 2) If the superpeer die, the subscribes will be lost. Each peer must resubscribe all souls.
- Loading branch information
Showing
6 changed files
with
82 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
|
||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0" /> | ||
<title>Testing AXE</title> | ||
</head> | ||
|
||
<body> | ||
<script src="../gun.js"></script> | ||
<!-- <script src="../axe.js"></script> --> | ||
<!-- <script src="../sea.js"></script> --> | ||
<script> | ||
var pid = location.hash.slice(1); | ||
|
||
var opt = ({ | ||
peers: [`${location.origin}/gun`] | ||
}); | ||
|
||
if (pid) { opt.pid = pid; } | ||
|
||
Gun.on('opt', function(ctx) { | ||
this.to.next(ctx); | ||
ctx.on('hi', function(opt) { | ||
console.log('HI!! PEER', new Date(), opt.pid); | ||
}); | ||
if (pid) { | ||
ctx.on('out', function(msg) { | ||
msg.pid = pid; | ||
this.to.next(msg); | ||
}); | ||
} | ||
}); | ||
|
||
var gun = Gun(opt); | ||
//var user = gun.user(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters