How to get typing status of the other side with javascript?

The chat client code sends something back to the server when it sees a keyboard event. The server then either pushes information to other clients, or else the other clients poll the server every once in a while.

Up vote 0 down vote favorite share g+ share fb share tw.

I've seens this in various places, during chat,I can see whether the other party is typing or not . How do implement this most easily? Javascript ajax typing link|improve this question asked Feb 2 '10 at 14:23user1987293,657128112 49% accept rate.

" You can't - this is one of the trickiest things to do with HTTP. – Emil Ivanov Feb 2 '10 at 14:27.

Making a separate request on each keypress would be extremely inefficient. – SLaks Feb 2 '10 at 14:32.

You'll need to use AJAX. When user A first presses a key, you can tell the server that he started typing. 5 seconds after the last keypress (call clearTimeout and setTimeout in onkeyup), tell the server that he stopped.

Then, on user B's side, use polling or comet to ask the server what it received from user A.

This is can be solved using XMPP/BOSH way. Check for Strophe. Js -- very good xmpp library.

Or you can do this with AJAX and server polling... I'd recommend XMPP...

Have you ever digg into how Strophe. Js implements Comet? – user198729 Feb 2 '10 at 16:44 No, I didn't.

And i'm sure its a server technology - long-help request a-la Comet. So here we need to talk about "how jabber server (BOSH) implements it". – NilColor Feb 2 '10 at 21:17 Actually,I don't think it's a pure server technology.

– user198729 Feb 3 '10 at 10:43 Yes, its not. Client must understand that this request must be long-held. Personally I prefer xmpp way.

But Comet is good too. You can choose - each of them can help you with all kind of chat notifications. But keep in mind thad jabber servers already support it (via presence/iq/etc stanzas) and you can chat with people who uses desctop clients like Adium/Miranda.

With Comet you can't do this. – NilColor Feb 3 '10 at 12:21.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions