Jump to content

Live Updating


ProblemHelpPlease
 Share

Recommended Posts

I am looking at adding the ability to force all users viewing a page to receive an update to the page (a new text entry) at the moment that it is added by another user, something similar to they way chat rooms work.The active part that needs to show the live updates will be text in a textarea field. Currently any text typed into the textarea is automatically inserted into a database with the use of javascripts onkeyup() and some ajax. Other users are required to refresh there page to see the latest updates in the textbox and this is the bit that I would like to avoid.I haven't ever needed to do this before so don't have knowledge of what would be the best way to go about this.

  • Like 6
Link to comment
Share on other sites

The issue I have is how to update multiple textarea boxes on the same page. They are created dynamically so numbers can be anywhere from 1 to 100 boxes, each linked to a different row in the database. If it was just updating 1 box then I could achieve this with some JS but with so many boxes I can see it struggling to handle the volume. Any ideas how to get round this, I can't reduce the number of boxes.

Link to comment
Share on other sites

  • 2 weeks later...

I tested the update using 100 boxes which is about the most I will see on the page and the javascript was slowing the page down slighty which was a problem as the page cant afford for this to happen.I made a different solution using a simple mouseover on each textarea that fetches the latest content for the textarea from the mysql server and redisplays it in the textarea. As a user puts there cursor in the textarea to type a message it activates the update and redisplays the message before they can type over it. As it only affects each textarea individually it massively reduces the update time.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...