agical / friendsunhosted

FRIENDS#UNHOSTED - Own your network!
http://friendsunhosted.com/
Other
13 stars 2 forks source link

Message passing #16

Open brolund opened 12 years ago

brolund commented 12 years ago

We do want to keep F#Un a distributed application, preferably without any dependencies on a central server. This would make it more robust in case of "problems".

In order to be able to find friends, or see what happens, a message passing function should be implemented.

Example: I add someone a few steps away in the network. I put a message in my outbox for that person:

{to:person@storage.org, TTL:5, expires: 2012-12-24 message: encrypt(personspublickey, {username:"brolund@5apps.com", added:"person@storage.org"})}

My nearest friends poll my outbox, see that it is not for them, decreases TTL, puts it in their outbox. After a while the message (hopefully) reaches the intended recipient.

The messages could be anything, this is one example.

The TTL should limit flooding. The expires deletes old messages.

Any user could limit their outbox size to their liking.

The encryption is to avoid tapping or network mining (tin foil hats on).

johlrogge commented 12 years ago

I think what we talked about is that the message should be a reference to a key in the senders public store where the message is stored, encrypted or unencrypted.

jancborchardt commented 12 years ago

This is great! With Libre Docs we just used WebSockets because they were in Etherpad Lite – but it’s very interesting how to actually be able to pass messages completely without central server.

Only one thing about the proposal: I’d cut the expires part, because that might result in the message being lost. Could there instead be something which will automatically be broadcast by the recipient upon receiving the message, causing all people they are in contact with to delete the message – including the sender, and all people they are in contact with.

brolund commented 12 years ago

Removing expires is a possibility.

One problem with a delete message is that it could potentially need to travel farther than the original message did to reach everyone that needs to delete it, and we always face the risk of not reaching everyone. Hence, eventually we need to prune the outbox anyway, and expires is probably a good way. :-)

And messages will be lost, we just have to figure out how to live with that. ;-)

johlrogge commented 12 years ago

Yes, expires is just a way to prune the outbox. The will live in the outbox as long as there is space. When pruning messages will be removed in expirationorder.

End messages will be lost. Some will not have a possibility to reach the intended recipient but the possibilities will increase as the network grows.

jancborchardt commented 12 years ago

Hm, I would say making sure as much as possible that messages will not be lost is one of the most important things of the whole thing. If user data gets lost in any way then we screwed up.

Expires set to a reasonably long time, like a month or later after the send date is probably good though.

johlrogge commented 12 years ago

The data will not be lost, the message(event) will. If it is not confirmed by the recipient within the expiration time the sender can resend it. (confirmation can be as simple as adding the message id under a received key in the recipients store)

It is important to avoid overflowing peoples outboxes as well and keep the "event-data" from becoming humongous.

jancborchardt commented 12 years ago

As long as the sender info and a key to the message is there, the whole message doesn’t even have to be handed down. Or is that better to make sending and receiving faster?

johlrogge commented 12 years ago

@jancborchardt Yes, see my first comment in the thread

jancborchardt commented 12 years ago

@johlrogge ah, sorry. :)

johlrogge commented 12 years ago

@jancborchardt No reason :) It was a different way of saying +1 :)

johlrogge commented 12 years ago

Just braindumping a bit that has been said and thought offlline of this feature

While some of the above sounds complicated, the implementation of the needed datastructures are simple but the algorithms can be more or less complicated..

johlrogge commented 12 years ago

It also seems like message passing should be a separate project (that has also been talked about offline). Everyone will benefit from as different apps as possible using this feature reliability grows with the number of route points.