cabal-core icon indicating copy to clipboard operation
cabal-core copied to clipboard

reveal how many peers have received a message

Open hackergrrl opened this issue 6 years ago • 6 comments

Something like

core.publish({type:'chat/text', content: 'hello'}, function (err, msg, uploadListener) {
  uploadListener.on('uploaded', function (peerKey) {
    // update UI
  })
})

This'd be ephemeral data, and so wouldn't be persisted to disk (unless we wanted to start doing that). It'd be enough for a short-lived indicator beside a message to show that it's been shared to some peers in the swarm.

hackergrrl avatar Jun 13 '19 16:06 hackergrrl

oh i like this a lot! is it possible to do already or do we need to implement this in core?

(on phone in bed hehe)

On 13 Jun 2019, at 18:21, noffle [email protected] wrote:

Something like

core.publish({type:'chat/text', content: 'hello'}, function (err, msg, uploadListener) { uploadListener.on('uploaded', function (peerKey) { // update UI }) }) This'd be ephemeral data, and so wouldn't be persisted to disk (unless we wanted to start doing that). It'd be enough for a short-lived indicator beside a message to show that it's been shared to some peers in the swarm.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

cblgh avatar Jun 13 '19 21:06 cblgh

@cblgh: It needs to be implemented still. I think cabal-core would just, after publish but before calling its cb, get the seq# of the message it just wrote, and add an event listener on that hypercore for the 'upload' event.

hackergrrl avatar Jun 13 '19 22:06 hackergrrl

@noffle ah yes great!

cblgh avatar Jun 14 '19 06:06 cblgh

@substack's ACK pr for hypercore would be great for this https://github.com/mafintosh/hypercore/pull/215

cblgh avatar Jul 29 '19 09:07 cblgh

https://github.com/mafintosh/hypercore/pull/215 has landed!! this is now possible to implement using the latest hypercore

cblgh avatar Aug 07 '19 10:08 cblgh

W0000T this is great!! Thanks @cblgh, and thanks to @substack for the work on this.

dwblair avatar Aug 07 '19 11:08 dwblair