'User is typing a message' function...? 'User is typing a message' function...? ajax ajax

'User is typing a message' function...?


Use a timer to send an AJAX request onkeyup that tells the database the user is typing, on the other side when your pulling down chat messages you can then notify the other person that they are typing.

Take a look at doTimeOut which has a great example of debouncing in javascript...

http://benalman.com/code/projects/jquery-dotimeout/examples/debouncing/


You could to try check if your message textbox is filled with something every n seconds. If so, fire an server request to update that status between both users.


Using JavaScript check every (lets say) 2 seconds if any key is pressed at chat window. If yes, then send an Ajax request to tell your application that user is typing something.