Page 1 of 1

php chat concept

Posted: Fri Jan 31, 2003 8:38 am
by E_Fox
How does php chats work? Do they keep open a live connection or it just looks that way?

Posted: Fri Jan 31, 2003 10:36 am
by DeGauss
Are you talking about the IRC Module stuff built for PHP?

Posted: Fri Jan 31, 2003 2:49 pm
by evilcoder
PHP cant really have a proper relay as it cant print onto the page in real time, it must be refreshed before new data is added.

Posted: Fri Jan 31, 2003 2:58 pm
by E_Fox
I don't know about the irc module for php. where can I find it? I just a saw site which had php chat, and I'm wondering whats the concept, because browser don't keep the connection alive. As soon as the page is loaded the connection is closed.

Second, it must be all server side processing and that means too much load on the server.

thanks for the replies

Posted: Fri Jan 31, 2003 3:37 pm
by DeGauss
Oh... I understand now.

I'm working on (ha!) something along the lines of what you're talking about.

I'll be quite happy to release the source code to you if you want to develop it further, as i'm notorious for developing things to a certain point and then losing interest...

http://www.vanillacity.com/geek/phptalker/

Posted: Fri Jan 31, 2003 4:14 pm
by evilcoder
In PHP chat scripts the database connection is never closed, refreshing the browser mearly gathers the new information entered into the database. And yes, php chat scripts do place a high load on the servers performance, think about it, 30 people chatting = 30 database queries every 3 seconds (refresh rate) + bandwidth consumption.

server load

Posted: Thu Feb 06, 2003 9:35 am
by Skittlewidth
I've very recently written a chat script which is only for use between 2 or 3 people, and I've deliberately slowed the refresh rate down to once every 30 seconds for two reasons - one because when I'm chatting I should probably be working and so should the other person, and two I'm concerned about the load on the server. 8O
I reckon the database gets queried up to once every 5 seconds if a particluarly good discussion is going and once every 15 to 20 seconds if the message pane is left open (you can temporarily close it when you aren't paying attention to avoid needlessly refreshing and calling the database).
My question is, just how much of a load will this create on the server? Normally I wouldn't be too concerned, but its hosted (I bought space) on the company that I work for 's commercial server, and the last thing I want is for my boss to pick out my IP address from the log files! Would a drop in server perfomance be noticable or even caused by just two people running this script between 9am and 4pm?! :oops:

Skittlewidth

Posted: Thu Feb 06, 2003 11:11 am
by fractalvibes
Here is a link to an ASP-based chatroom application:

http://www.aspalliance.com/peterbrunone/chatroom.asp

If PHP has the equivalent of Application variables, it could be adapted.
Application vars can be shared by all sessions using an application. If PHP has no equivalent, you could use a DB instead.

Phil J.