I'm not exactly sure how to title this thread, or even where to put it. This is a problem that has had me wondering for a while now, and I'd finally like to put that to rest
My question is this:
How can I send data to an external page, and have it run a function in another user's browser?
It's kind of complicated without an example, so here's a real-world example:
2 people are in a chat room
Person 1 sends a message
Person 2 gets the message
...Simple as that, right? Well, I thought so too, until I actually tried coding a chat script. I came to the part where Person 2 receives the message, and was stumped. How could Person 2's script possibly know there's a new message waiting to be loaded without checking for one? Person 2's script would have to check the file a few times per second to get an accurately updated chat log, which is very heavy on the server.
I'm assuming that professional chat rooms don't work like this. Person 2's script would receive a piece of data telling it to update the script, and it would. But how would you do that, again, without checking every second?
Thanks,
-PG 
|