I'm writing an AJAX/PHP chatting application (similar to liveperson) and I'm using the Script.aculo.us/Prototype Library for AJAX Functions.
When the page loads, I initialize the chat. During the initialization, i startup 2 PeriodicUpdaters.
1. This one updates the "chat window" when new messages arrive, it re-queries the database and displays the newest string of messages.
2. This is a typing message display. When a user is typing, it writes a 1 to the database. The user on the other end can now check to see if that 1 is in the database, and now know if the other user is typing.
So basically, I can have a total of about 4 AJAX requests running at the same time.
1. Chat Window Updater
2. Typing Message Updater
3. Typing Message writer (tells the database when I am typing)
4. Message Sender (sends the typed message to server)
The problem I'm ending up having is typing tends to get "laggy". It's not as smooth as if nothing else is going on. I've tried turning off all but 1 constant Updater, but it still gets "hung" up mid-typing, as well as my messages don't get sent very quickly. Sometimes they don't get sent in the right order, or don't get sent at all.
I am just curious if anyone has worked on this type of application and have found a better way to handle each of these tasks much more efficiently.
_______________
_brian.
When the page loads, I initialize the chat. During the initialization, i startup 2 PeriodicUpdaters.
1. This one updates the "chat window" when new messages arrive, it re-queries the database and displays the newest string of messages.
2. This is a typing message display. When a user is typing, it writes a 1 to the database. The user on the other end can now check to see if that 1 is in the database, and now know if the other user is typing.
So basically, I can have a total of about 4 AJAX requests running at the same time.
1. Chat Window Updater
2. Typing Message Updater
3. Typing Message writer (tells the database when I am typing)
4. Message Sender (sends the typed message to server)
The problem I'm ending up having is typing tends to get "laggy". It's not as smooth as if nothing else is going on. I've tried turning off all but 1 constant Updater, but it still gets "hung" up mid-typing, as well as my messages don't get sent very quickly. Sometimes they don't get sent in the right order, or don't get sent at all.
I am just curious if anyone has worked on this type of application and have found a better way to handle each of these tasks much more efficiently.
_______________
_brian.