Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display stats for peer connections on history page #43

Open
chrisekelley opened this issue Apr 14, 2018 · 3 comments
Open

Display stats for peer connections on history page #43

chrisekelley opened this issue Apr 14, 2018 · 3 comments
Assignees

Comments

@chrisekelley
Copy link
Contributor

No description provided.

@chrisekelley
Copy link
Contributor Author

chrisekelley commented Apr 15, 2018

Peer connections are currently displayed at the bottom of the screen, with a substring of the dat's uuid. this data does not need to always be displayed. Why not enhance the history page to display it, and offer more options?

Current history screen:

screenshot_20180415-122621

Proposed update: beside each link there would be a button that displays current number of peers. Clicking this button would reveal peer sharing details. The button marked C would clone the dat.

bunsen-history-buttons

@chrisekelley
Copy link
Contributor Author

To map the hashbase url to the dat uuid, datGateway, which extends DatLibrarian, has a promising method:

resolve
Promification of dat-link-resolve for convenience's sake.

Parameters

link (String | Buffer) Link to a Dat archive

Examples

DatLibrarian.resolve('garbados.hashbase.io').then((key) => {
  console.log(key)
  > 'c33bc8d7c32a6e905905efdbf21efea9ff23b00d1c3ee9aea80092eaba6c4957'
})
Returns Promise<Buffer> Key of that Dat archive

See bunsen/www/nodejs_project/index.js for example of using DatGateway:

const gateway = new DatGateway({ dir, dat, max, period, ttl })
gateway
    .load()
    .then(() => {
        return gateway.listen(port)
    })
    .then(function () {
        console.log('[dat-gateway] Now listening on port ' + port)
    })
    .catch(console.error)
// gateway.on('join', (dat) => {
//     // let dar = dat.archive.
//     let connections = dat.network.connections.length
//     let key = dat.options.key
//     console.log(key + " has " + connections + " peers.")
// })

So, this may be as simple as

gateway.resolve('garbados.hashbase.io').then((key) => {
  console.log(key)
  > 'c33bc8d7c32a6e905905efdbf21efea9ff23b00d1c3ee9aea80092eaba6c4957'
})

We'd then need to provide it as a service by the node server.

Then we need to make this available to the bunsen-ui polymer custom element code. So, in bunsen-ui/src/bunsen-app/bunsen-app.js, we'd fetch this array of hashbase urls:dat uuids from the server, and then fetch them when writing the datSites localStorage object

{"address": "${address}", "url": "${url}"}

@chrisekelley
Copy link
Contributor Author

Here's where we are with the peers UI:

screen shot 2018-04-15 at 9 41 00 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant