Linux Systems Administrator
Jupitermedia
US-AZ-Tucson

Justtechjobs.com Post A Job | Post A Resume

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.

Next Page


Comments:
RE: ehm a relational database for at chat?!bison04/25/04 19:27
Did someone made this working ?Jean-pierre11/21/02 15:15
RE: chat codingJainendra10/24/02 02:20
storing data lee10/02/02 08:19
Cold Feets from seeing the log belowEl Aïd El Othmani Nabil09/06/02 07:04
An error in form.phpElvin Chua08/31/02 02:09
The code has an error.Elvin Chua08/31/02 01:24
PHP, MySQL and JavaScriptElena Iasonos08/27/02 11:39
chat codingNitin08/14/02 04:36
this does not workRed07/24/02 18:13
Manipulating remote filesBoba Fett05/21/02 23:20
how will you compare login name & passwordsam05/03/02 07:47
how to store links in data base..koshlesh04/07/02 06:17
RE: What is the different of PHP and ASPrahul b.03/18/02 10:08
RE: Getting remote filesMichael Rohde03/16/02 00:49
RE: what is CORBA ?Ndede, George02/20/02 22:20
Getting remote filesJasper Steenkamp01/29/02 01:58
exec and the rootAdrian12/04/01 16:18
I get the following error..umeshkumar12/03/01 08:21
session_start bug !jarod cinzano, web developper10/26/01 09:02
what is CORBA ?ta anh09/15/01 05:38
ODBC for NTtony08/01/01 00:05
variable from php to javascriptWillet06/26/01 19:42
What is the different of PHP and ASPNicky04/14/01 14:26
RE: Web-based ChatMarco03/13/01 10:06
SQL Named Pipes Johann02/13/01 11:17
radiobuttonchandra sekhar01/19/01 04:22
RE: CompressionLuis Argerich01/12/01 11:19
CompressionErik Gustavsson12/15/00 08:21
Location errorMichael Bykov10/30/00 09:49
javascript+phpAaron10/29/00 16:06
RE: A comment on the JavaScriptDannie M Stanley08/26/00 14:02
RE: Web-based Chatchan08/18/00 13:50
RE: Web-based ChatJani Kaarela08/14/00 13:29
Web-based Chatle van son08/07/00 05:59
A comment on the JavaScriptJonathan Hurshman08/03/00 17:43
RE: I get the following error:Fredrik Kristiansen07/28/00 06:54
Recomendation (please read)Luis Argerich07/25/00 09:34
RE: I get the following error:hamster07/25/00 06:53
I get the following error:Sascha Endlicher07/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.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.