Forum Moderators: open

Message Too Old, No Replies

experience getting ajax chat to work?

         

distorto

7:52 pm on Sep 10, 2007 (gmt 0)

10+ Year Member



there are so many examples around for ajax "chat" apps, but I've read a couple posts that claim that using ajax for a real chat application is unwise and that java is better.
Our whole server setup is php mysql, so that's not going to change, but I've found a number of java chat apps that seem fine and it seems like I could implement them. does anyone have experience with gettign web based chat happening on a large scale website? how did you do it?
for that matter, does anyone know how gmail's chat app work? I assume that's ajax, but I would love a confirmation.

misterjonez

7:26 am on Sep 11, 2007 (gmt 0)

10+ Year Member



hmmm, try the server side flash media server 2 then embed it to your ajax chat. I think thats how it works.

distorto

3:21 pm on Sep 11, 2007 (gmt 0)

10+ Year Member



I went searching for info about this and found a post from you from last month
"Hello,
Does anyone can help me about simple chat using flash media server 2?"

did you get it to work?

misterjonez

2:49 am on Sep 13, 2007 (gmt 0)

10+ Year Member



yes fms2 is cool learn a little bit. :-)

I've try making ajax chat but it causing alot of problem to the server side and client side. overload using the interval. :(

vincevincevince

2:53 am on Sep 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A well designed AJAX chat system built on PHP, MySQL and flat files can work very well indeed.

distorto

3:27 pm on Sep 13, 2007 (gmt 0)

10+ Year Member



what do you use the flat files for?
I have a simple chat system working that just reads and writes to a mysql database. I'm not using any flat files.
I'm somewhat worried about the server overload problems mentioned above. Any tips?

Gibble

3:35 pm on Sep 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We have a chat system that works really well, we didn't use flat files, or a db, just stored the last dozen or so remarks in memory, though, we didn't care about keeping records.

distorto

3:53 pm on Sep 13, 2007 (gmt 0)

10+ Year Member



the system that I'm building lets users of the site chat one on one with each other. There's no group chat. also, I want the system to allow up to three simultaneous instances per user. all in all, it could add up to a whole lot of simultaneous instances of this "chat" app. This is the reason I'm a little concerned about performance issues.

Gibble

4:22 pm on Sep 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's basically how ours works, everything is in memory though. It's quick, and we've had no issues. When you start hammering a db or file ever second or two from a bunch of users, that's why you take a performance hit.

distorto

4:30 pm on Sep 13, 2007 (gmt 0)

10+ Year Member



I have to admit that I don't know what you mean by "storing in memory". Would this be a possible solution for a large scale website with many many users?

Gibble

4:43 pm on Sep 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well you're not storing everything...just a few posts, we have them in the httpcontext cache if I recall correctly (.NET 2.0) Each chat session has maybe 10 messages stored, and a little info on who is in the session.

The user sees the entire chat, because with AJAX, we can just append new posts to the chat window without having to rewrite everything, thus, old messages don't need to be stored for the user to see their session's history. The only time they lose it is if they refresh the entire page, which is why we keep 10 or so messages in memory.

Gibble

4:43 pm on Sep 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



btw, define "large scale" with "many users"?

distorto

4:56 pm on Sep 13, 2007 (gmt 0)

10+ Year Member



If the project is successful, then I'll be faced with a million or more users per day. That sort of traffic is probably a ways off, but my company is shooting for those sorts of numbers. If the project takes off, I'm sure I'll be able to hire more people and potentially rethink things, but I'm trying to build a system that's as extensible as possible.
I was very nervous to try to implement an ajax chat box on the site, but after seeing gmail's chat implementation, I became convinced that it CAN work.

Gibble

5:01 pm on Sep 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's why you build things in layers.

frontend -> logic -> data access -> data

That way you can just change out your data layers if you find one way too slow, resource intensive, whatever.

misterjonez

8:51 am on Sep 14, 2007 (gmt 0)

10+ Year Member



yeah! AJAX chat using server side PHP & MySQL is not the long term solution.

But maybe small traffic wont effect overload.