Okay, so we know how to submit from the client asynchronously...
The question is, how does google chat do it? For those people that haven't used google chat, it is a web based chat client which behaves just like a normal one.
In other words, if I'm in a chat session with someone I get messages like "Bob is typing", and when Bob finishes typing, then bobs messages comes through. It appears as if the server is initiating communication with the browser! How do they do that?
The exercise started off by wanting to look at how AJAX apps built with google web toolkit submit data to the server - for this I installed a very funky plugin called "firebug". I was looking for something that would enable me to view the xml http requests submitted by the browser and this is exactly what firebug offers, along with a whole bunch of other stuff.
I used firebug on one of my simple gwt apps, and it showed me what I was looking for, then I thought I'd try it on google mail. It wasn't long before I realised how google's chat works.
Very simple to be honest. Nothing profound at all! When you initiate a chat with someone and click enter, it sends that chat message, but also submits another one. This one does not return immediately, but only returns when the user you're chatting with writes something! If it times out, as far as I know, timeout is 90 seconds, then it will receive a "nothing happened" message and then submit another "if you have anything to say put in this bucket" message. In fact, multiple buckets can be submitted in order that there is always one available.
It shouldn't surprise you that this mechanism has also been given a name and it is called "Comet".
A blog with a focus on Software Programming but could include other relevant topics as well
Subscribe to:
Posts (Atom)
How important is the programming language?
Python, typescript, java, kotlin, C#, .net… Which is your technology of choice? Which one are you currently working in and which do you wa...
-
So you want to do Unit Testing... it's a noble goal and good goal that every development shop or environment should have. And it is a go...
-
On the weekend I spoke to a friend and we were talking about the SOLID principles. We talked at lengh about Inversion of Control/Dependency...
-
Recently, anecdotal evidence has suggested to me that java's influence has been on the wane... Especially given the view in Cape Town, S...