lewisl9029 / toc

Toc Messenger - A distributed messaging app that can sync across all of your devices
http://toc.im
GNU Affero General Public License v3.0
56 stars 1 forks source link

Implement and test simultaneous login with separate telehash id for each device #176

Open lewisl9029 opened 9 years ago

lewisl9029 commented 9 years ago

Looks like theres no need to have separate telehash id per device if we have a shared storage medium.

https://github.com/telehash/telehash.org/blob/master/v2/faq.md Can one hashname be used in two places at once? - As two completely distinct/decoupled entities, no, it would cause conflicting line handshakes depending on whichever hashname responded first. If implemented so that there is some shared private state/storage mechanism between the instances where line information is held and coordinated, then yes a hashname can be available at many different network locations. For example, one hashname can be used from many datacenters simultaneously as long as they all use the same distributed database for line state.

lewisl9029 commented 9 years ago

Should wait until #152 is done to avoid wasted work.

lewisl9029 commented 9 years ago

Try a simpler, less robust approach using remotestorage flags:

  1. Generate random clientId for each client stored locally
  2. Set explicit client status in remotestorage on login/logoff, Counter per client that increments while online for implicit status (to detect unclean disconnects)
  3. Don't actually connect to the telehash network if another client is online and and incrementing counter
  4. Online client sends and receives, syncs state to offline clients using remotestorage
lewisl9029 commented 9 years ago

See if doing a delete on all session properties would disconnect the telehash session

lewisl9029 commented 9 years ago

Seems too error prone to implement since shared session state isn't actually supported by telehash v2. In fact, there doesn't even seem to be a documented way to disconnect a client, which is necessary for the alternative approach above.

Opened #191 as an alternative.

lewisl9029 commented 9 years ago

Reopening to keep in mind that we still want to have this eventually.

Having a separate telehash id per device is going to involve a pretty thorough overhaul of the entire messaging stack though, so it's probably a good idea to work through some of the lower hanging fruits first.