English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Two clients are visiting the same website at the same time.
We have both IP addresses in server DB.
Once client sends a message (a form) to the server (trigger event)
Server stores form data to DB, then MUST refresh page of the other client.
How to do this? (PhP, MySQL...)

2007-07-19 21:34:25 · 2 answers · asked by just "JR" 7 in Computers & Internet Programming & Design

Soh. Know that. Auto-refresh with timer is what I am using... Not elegant.
But Messenger "pops up" if a new msg arrives in your box! That IS an event...

2007-07-19 22:03:54 · update #1

2 answers

Web browser didn't have 'listener' feature, they must make a request to get data from webserver.
Yahoo Messenger is designed to send and 'listening' .
when you see your browser automatically refresh, it because in the html source, they have some 'timer' that make a request from your computer to the webserver every several seconds.
Http is strict and bind by the rule. Yahoo is free to design whatever they want.

you can build application like Yahoo! Messenger, use port 80 like Http port and do whatever you want between your client application and your server application, but for Web Browser like IE, Firefox, Opera etc, they follow the webserver rules.
http://www.chebucto.ns.ca/~rakerman/port-table.html

if you want to build chat site, goto this site :
http://www.hotscripts.com/PHP/Scripts_and_Programs/Chat_Scripts/index.html
http://www.bigwebmaster.com/PHP/Scripts_and_Programs/Chat_Scripts/
http://phpopenchat.org/

2007-07-20 08:48:20 · answer #1 · answered by Manzana verde 5 · 0 0

HTTP is stateless and there is no way that a server remembers a data transfer to a client; therefore, what you are looking for cannot be done in server side alone. The best way would be to use Ajax and an interval timer in the client side to check periodically if the data has been updated.

Good luck.

2007-07-19 21:47:08 · answer #2 · answered by ʃοχειλ 7 · 0 0

fedest.com, questions and answers