Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Discussion: DatArchives sending "signals" to each other #1295

Closed
mikister opened this issue Dec 28, 2018 · 4 comments
Closed

Discussion: DatArchives sending "signals" to each other #1295

mikister opened this issue Dec 28, 2018 · 4 comments

Comments

@mikister
Copy link

Could it be possible for DatArchives to send "signals" to one another.

Implementation Suggestion:

An experimental API that behaves similar to creating a JS custom event, e.g.:

// Target of the datSignal
var otherArchive = new DatArchive(otherArchiveLocation);

// Create a Custom datSignal
var updateSignal = experimental.datSignal("Update");

// Dispatch the datSignal
updateSignal.dispatchTo(otherArchive);

And on the front-end side this doesn't event need to be implemented, but the JS event system could be used instead.
Say, in that otherArchive the updateSignal is received by an EventListener updateEvent attached to document, and when the archive receives that signal it just fires off that updateEvent.

@pfrazee
Copy link
Member

pfrazee commented Dec 28, 2018

Is the idea that these signals would go over the network, and the signals would go to the dat owners?

@pfrazee
Copy link
Member

pfrazee commented Dec 28, 2018

Or is the idea that these are just custom events that you could fire on the objects within your app?

@mikister
Copy link
Author

The former. The signal would be dispatched to the target archive which would receive it and fire it off as a JS event inside of its own html page.

Also I can see one problem in this and that is that archives aren't available all the time, so there might not be an archive to receive the signal. A solution might be to implement/reuse a watcher (just like the one used for the Beaker Watchlist) and dispatch the signal when the archive becomes available.

@pfrazee
Copy link
Member

pfrazee commented Dec 30, 2018

@mikister yeah that's a solid idea, basically using Dats as identities. We've got some tools for messaging in the works with beakerbrowser/beaker-core#6 so we might be able to accomplish that kind of stuff.

@pfrazee pfrazee closed this as completed May 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants