|
PHP & JavaScript World Domination Series: Storing data in the client.
Luis Argerich, Alejandro Mitrou
One of the things that all programmers love is to write a program which writes another program. On the web we have two different programming environments: the client (browser) and the server. Due to the HTTP protocol definition we can write a program on the server which writes another program to be executed on the client. Let's pick PHP (of course) for the server and JavaScript for the client. We'll show you in this article how you can use this scheme to store data in the client and then minimize the data transfered between the server and the browser for interactive applications like a chat room, a news system or whatever you want.
Ingredients:
- PHP4
- JavaScript
- Frames
The Idea:
We have been trying to develop an HTTP chat room in PHP for a while. HTTP is not a good protocol for chatting but it is firewall/proxy immune, can use the potential of PHP and there's no need for Java Applets. We have had two main problems with the chat room: first since IE doesn't support the PUSH method, we needed to make it a "pull" application, (the client refreshes itself) which is unnatural for a chat application. We decided to make the client refresh time variable, the server will generate the refresh time as a function of the number of messages received in the server in the last x minutes. The second problem was deeper: since the idea is to refresh the client we would need the server to send all the messages each time, we observed that this implied heavy transfers and our benchmarks in a simulated simplified chat room model showed that this was the main cause of delays in the chat. This article deals with that second and deeper problem.
| Comments: | ||
| RE: ehm a relational database for at chat?! | bison | 04/25/04 19:27 |
| Did someone made this working ? | Jean-pierre | 11/21/02 15:15 |
| RE: chat coding | Jainendra | 10/24/02 02:20 |
| storing data | lee | 10/02/02 08:19 |
| Cold Feets from seeing the log below | El Aïd El Othmani Nabil | 09/06/02 07:04 |
| An error in form.php | Elvin Chua | 08/31/02 02:09 |
| The code has an error. | Elvin Chua | 08/31/02 01:24 |
| PHP, MySQL and JavaScript | Elena Iasonos | 08/27/02 11:39 |
| chat coding | Nitin | 08/14/02 04:36 |
| this does not work | Red | 07/24/02 18:13 |
| Manipulating remote files | Boba Fett | 05/21/02 23:20 |
| how will you compare login name & password | sam | 05/03/02 07:47 |
| how to store links in data base.. | koshlesh | 04/07/02 06:17 |
| RE: What is the different of PHP and ASP | rahul b. | 03/18/02 10:08 |
| RE: Getting remote files | Michael Rohde | 03/16/02 00:49 |
| RE: what is CORBA ? | Ndede, George | 02/20/02 22:20 |
| Getting remote files | Jasper Steenkamp | 01/29/02 01:58 |
| exec and the root | Adrian | 12/04/01 16:18 |
| I get the following error.. | umeshkumar | 12/03/01 08:21 |
| session_start bug ! | jarod cinzano, web developper | 10/26/01 09:02 |
| what is CORBA ? | ta anh | 09/15/01 05:38 |
| ODBC for NT | tony | 08/01/01 00:05 |
| variable from php to javascript | Willet | 06/26/01 19:42 |
| What is the different of PHP and ASP | Nicky | 04/14/01 14:26 |
| RE: Web-based Chat | Marco | 03/13/01 10:06 |
| SQL Named Pipes | Johann | 02/13/01 11:17 |
| radiobutton | chandra sekhar | 01/19/01 04:22 |
| RE: Compression | Luis Argerich | 01/12/01 11:19 |
| Compression | Erik Gustavsson | 12/15/00 08:21 |
| Location error | Michael Bykov | 10/30/00 09:49 |
| javascript+php | Aaron | 10/29/00 16:06 |
| RE: A comment on the JavaScript | Dannie M Stanley | 08/26/00 14:02 |
| RE: Web-based Chat | chan | 08/18/00 13:50 |
| RE: Web-based Chat | Jani Kaarela | 08/14/00 13:29 |
| Web-based Chat | le van son | 08/07/00 05:59 |
| A comment on the JavaScript | Jonathan Hurshman | 08/03/00 17:43 |
| RE: I get the following error: | Fredrik Kristiansen | 07/28/00 06:54 |
| Recomendation (please read) | Luis Argerich | 07/25/00 09:34 |
| RE: I get the following error: | hamster | 07/25/00 06:53 |
| I get the following error: | Sascha Endlicher | 07/24/00 21:26 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


