Wednesday, 24 November 2010

GUIs, RPC and everything

The idea has been in my head for quite some time; but before explaining it please give me some time to explain the circumstances. By recently having bought a smartphone that enables me to write instant messages and using a laptop when away from home, my instant messaging data are now split apart – believe it or not – to four locations: my Linux installation and my Windows installation at home, the laptop and the smartphone. This is especially a problem because you risk losing context if the communication is not actually instant but the location is switched between sending a message and receiving its reply. Plus, the rather unstable connection to the Internet of both the laptop and the smartphone make for great disconnect-connect spams for everyone that has me on their contact list.

So what's the groundbreaking idea and what does the blah about multiple devices have to do with it? The idea is to create an instant messenger where the program logic and the view (i. e. the UI) are only loosely connected via sockets. Whenever I've talked to someone regarding the idea, I was told that X.org already supports to access remote windows; this may be true, but proposing this as a solution is evidence of lack of understanding of the original problem: the problem is not how to share the UI of a program between computers, but how to synchronize multiple UIs so that they have the same state. The difference may sound subtle, but is extremely important. Different systems require different UIs, and thus it is not the right solution to share the view but one should rather share the state of the program in question. My approach is to save all RPC calls done on the server and resend them if a new client connects; this may sound extremely inefficient, but RPC calls that are redundant are not sent if the server marks them as closed. Moreover calls can be labelled as children of other calls and are automatically deleted from the server if the parent is (e. g. if the IM has RPC calls for opening a window, all RPC calls that make text appear therein would be children of the opening call and are thus not resent if the window is already closed).

I hope that more and more programs take on the approach proposed here to conform with the changes the computer industry has been going through leading to a vast range of different devices with radically different requirements to the UI. Decoupling the UI and the logic of native applications is also the next logical step in the direction of cloud-computing (the problems thereof will be not be elaborated as this is a completely different topic and would go beyond the scope of this post).

Work on an IM that uses the techniques elaborated in this post has been started by me today. I will first solve the meta-problem of syncing multiple remote UIs, and afterwards will write an instance messenger on top of it (probably using telepathy as multi IM library).

3 comments:

Abishek Goda said...

in some sense surprising nothing to this effect is already in place :)

phee said...
This comment has been removed by the author.
marcgaeh said...

I'm running irssi with irssiproxy on my server. In addition to irssi I have a local bitlbee server running, to which the irssi client is always connected.
In that way I can always use my favorite IRC client on any computer, connect to my server, authenticate and have instantly set up all of my IRC and IM accounts. I think that could be exactly what you are looking for.