I'm creating a messaging app and I'd like to implement the feature of showing when the other person, on the other side of a message, is typing. Because I'm used to using databases, my first inclination was to use a database on a web server to do it: the idea being that when UserA is typing, the database is updated, via web services, in the edittext_TextChanged event (given some unique criteria). UserB, whose app is polling the database, can, also via web services, view the timings entered from UserA and show, or not show, that typing is occurring.
This approach works (I've tried it!), however, the latency is limited to two web service calls. So, if, for example, UserA takes 25 seconds for the INSERT, via web service, to complete...and it takes UserB 20 seconds to retrieve the row, via web service...the answer that UserB sees is 45 seconds behind the actual keypress.
I'm not convinced that a database in between the users is the best method (i.e., lowest latency), and I was wondering if anyone knows of a better method to do this. Thoughts?
This approach works (I've tried it!), however, the latency is limited to two web service calls. So, if, for example, UserA takes 25 seconds for the INSERT, via web service, to complete...and it takes UserB 20 seconds to retrieve the row, via web service...the answer that UserB sees is 45 seconds behind the actual keypress.
I'm not convinced that a database in between the users is the best method (i.e., lowest latency), and I was wondering if anyone knows of a better method to do this. Thoughts?