An initial read forces gun to connect to peers

This commit is contained in:
Daniel Lugo 2021-10-05 11:55:25 -04:00
parent ac2ae7c2f8
commit 22b77e0b2f

View file

@ -85,6 +85,12 @@ const handleMsg = async msg => {
if (msg.type === 'init') { if (msg.type === 'init') {
gun = /** @type {any} */ (new Gun(msg.opts)) gun = /** @type {any} */ (new Gun(msg.opts))
// Force gun to connect to peers
gun
.get('foo')
.get('baz')
.once()
let currentPeers = '' let currentPeers = ''
setInterval(() => { setInterval(() => {
const newPeers = JSON.stringify( const newPeers = JSON.stringify(