Skip to content Skip to sidebar Skip to footer

Implementing Web Chat,how Do I Get Typing Status?

Can someone illustrate how I can get typing status of the other party with javascript? UPDATE Can someone recommend a one-to-one open source chatting application,preferably written

Solution 1:

Here are a list of PHP-based open-source instant messaging software.

Some of those might be relevant for you.

Solution 2:

For example, if you had an text area #chat then you could use this code to attach the event:

document.getElementById('chat').addEventListener('keydown', FUNCTIONHERE, false);

Solution 3:

See http streaming and some ready solutions here: http://ajaxpatterns.org/HTTP_Streaming

this is how google talk does it. And there are ready php or c++ solutions

It was quie a discovery for me!

Solution 4:

This is an update to reflect the significant change in the OP's question:

Google Chat and Facebook both use XMPP(jabber) servers, as do most companies I know of that have internal instant messaging.

The nice part about XMPP is that you get all of the "is typing" and other presence-based information without having to roll-your-own in javascript (bear in mind, you will still need to use javascript to pass XMPP requests back to the server, but XMPP has most of the features you'd need already built in).

Check out OpenFire. It's a great XMPP server, totally open source, and they have a web-based version of their Spark client that is pretty nice.

Or you could get a PHP library for XMPP (there are a few). But you'd still need to have the XMPP server running in the background for PHP to work with.

Here's a list of XMPP libraries for PHP from XMPP.org:

  • Eiffel
  • JAXL
  • Lightr
  • Missus
  • xmpphp

Or, if you want to keep things mostly browser-side, they also have a list of libraries for javascript:

  • dojox.xmpp
  • js.io
  • JSJaC
  • strophe.js
  • xmpp4gwt
  • xmpp4js

Solution 5:

I made a small chat application a while ago, and the only way to do it is to frequently check for new entries in the chat database and fetch anything newer than the last displayed message. At the same time as all that, you can check to see if the user's input is empty. If it is, do nothing. If it isn't, enter a status code into the database beside that user's name. If anyone has that status in the database when you're fetching information about new messages and who is online, you should display the 'user is typing' message. I hope that makes sense...let me know if it isn't.

Post a Comment for "Implementing Web Chat,how Do I Get Typing Status?"