Skip to content

Instantly share code, notes, and snippets.

@jondashkyle
Created April 21, 2018 15:47
Show Gist options
  • Save jondashkyle/19fce7dee0baf9d74167b1b7e9a33ad8 to your computer and use it in GitHub Desktop.
Save jondashkyle/19fce7dee0baf9d74167b1b7e9a33ad8 to your computer and use it in GitHub Desktop.
polling for peers
// https://beakerbrowser.com/docs/apis/dat.html#getinfo
var archive = new DatArchive(window.location.toString())
var peers = 0
setInterval(checkPeers, 2000)
async function checkPeers () {
var info = await archive.getInfo()
peers = info.peers
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment