Question

Kindly excuse me if I am asking a simple question. Please don't hesitate to edit my question to do the correct approach.

I am doing the java Chat project.

I think You are all aware of that in facebook and GTalk , when your friend is typing the message, You can able to notify that the User is typing message will be in your displayed in your end.

When he sent the message or completed the message typing , the User is typing message will be hidden.

How they are identifying that the other user is currently typing or not ?

Good answers are definitely appreciated.

Was it helpful?

Solution

Since your question doesnt include any code. This answer has to stay basic.

If your using JavaScript there many ways you could watch if the users typing:

For example if the user is focused on the input box and there is a key down event then send an ajax message saying "USER ID TYPING" then the server can handle that.

I think this is a similar question: "User is typing" function in chat

Please give some code so we are able to help!

-PLEASE ALSO NOTE-

Your implementation depends on what server side platform your using and how you want to interact.

I've done something similar in PHP where every 10 seconds i would see if there's a change if there i would send a AJAX request to PHP then update the clients that need to know that information

And for the message hiding or showing you can use:

JavaScript to change the visibility of the span that contains the message.

If you use jQuery then its $('#spanID').hide() or $('#spanID').show()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top