Click to See Complete Forum and Search --> : creating a chat room in flash
steveguberman
09-25-2003, 03:30 PM
I am looking to find out how to create a chat room for a clients site, I don't know if it needs to be done in Flash but I have seen them done that way through some of our elite members' sites and would love some support on this.
thanks,
Steve
the sherrif
09-25-2003, 04:04 PM
if you want to use flash to create a web based chat client, there are two options:
1. using a server backend such as php to record messages sent to it in some way (can be done using a database or a file with a maximum number of lines). the client loads the page using loadvars() at a set time interval. this method is laggy (as laggy as the time interval between loads) and heavy on bandwidth.
2. if you have the option of running a server on its own port, on the same domain as the website http server, then you can run a socket server for the flash client. the socket server is written in another language, usually java, and there are several available, such as Unity Socket Server. this method uses flashes xml socket methods, and uses a persistent connection. there is no time lag, and bandwidth usage is tiny.
3. i think communication server MX is another option, but i know little about it.
Tea_J
09-26-2003, 03:07 PM
Hi, if i may add..
I've been using the first method (PHP-MYSQL) and i just want to ask the technical difference using sockets and PHP-MYSQL (loadVars every 3 second interval)
My technique is not to load the whole content of the chat messages (txt or database), but rather use a log file which is updated everytime there is an activity (new message or new user).. then it is compared with the log time in flash.. if it is different, flash loads the data, and then update its log time..
How big is the efficiency gap between using a socket server and my methods..
Your input is greatly appreciated.
Tea J
the sherrif
09-27-2003, 05:28 PM
using loadvars() would usually put a lot of strain on the http server. imagine 30 users in a chat room, with each user polling the server every 3 seconds, that would lead to 600 connections/minute. thats why using a persistent connection is more effecient. also, in a simple socket server chat room, incomming data from a user is only relayed to all the other users in the chat room. the data itself isnt processed in any way (or if its an irc complient server, data beggining with "\" is handled by the server, and responds differently with each different command, allowing administration of the chat room, for example).
another reason is that users can be managed easier with a persistent connection to a server. for example, if a user is spamming a chat room, the admin can tell the server to "cut" his connection, and he's gone. if we were using a http server, he could still make http requests, and although he could effectivly be blocked using his IP, the server has to manage every message he sends to the server, which could seriously damage the response time from the server for legitimate users.
Tea_J
09-28-2003, 02:11 AM
i see.. ok how bout if there are only 2-10 users MAX... would it be that big a problem still???
My other concern is, i built this intranet application for small offices and it uses PHP-MYSQL-FLASH combination.. it checks the database for certain data every few seconds.
Your inputs are valued. :)
Tea J
Musicman
09-28-2003, 03:31 AM
Hi,
both Tea_J and the sherrif show some valid points here - there is no best solution for a chat room ...
Certainly socket servers are nice, but they have one big advantage: you cannot use them with a normal hosting company, and even if you can set up the server, some people may not be able to access it due to firewalls
Musicman
Tea_J
09-28-2003, 03:35 AM
ahhhh.. the master speaks.. :)
Musicman
09-28-2003, 04:13 PM
.... of course I wanted to say DISadvantage above :(
Musicman
Wancieho
09-28-2003, 09:40 PM
I've tried using the PHP/MySQL route on a local area connection and must say that the db queries were slower than the connection so the updates weren't running real time. I used a delay of 100ms in flash and the lag was about 1000ms. I also think the load can get heavy on your db if you have multiple conns. Obviously on the net you have added factor of bandwidth.
I have been tempted at looking at using communication server to see if I could improve on speed but never got around to it.
Tea_J
09-29-2003, 01:34 AM
well, i was careful with that, so, that's why:
Here are my points:
1) I have a logs table which is updated when there's an activity - user or message. This is so that you want have to unnecessary data
2) I dont really mind a few second delays.. My chat app checks the database every 3 seconds interval. Each interval is triggered when the previous check returns a result.
3) I'm looking at a maximum of 10 users only.. most of the time it's just 3 users tops.. This is a client support chat application.. and most of the time it is one on one chatting between client and my support person.
Watcha think?
Here's a prototype of the application.. It doenst use mysql yet, just plain text files for logs and etc..
teaconcepts.net/chat/
Please give it a go everyone..
Tea J
Vincent26381
09-29-2003, 08:13 AM
I made a chat with SWiSH max (almost same as flash MX). The chat uses just a single textfile. Now that it's displayed on a popular site I got over a gig bandwidth on it :(
It loads the whole textfile when you start the chat; only the last entry when it updates (once a second). I have had 20+ visitors. It still holds ok but the bandwidth sure is a problem.
http://www.avviso.nl/chat
BTW I found this link, could be usefull http://www.sephiroth.it/tutorials/flashPHP/flash_chat/page001.php
How to create a flash/php/mysql chat
Tea_J
10-01-2003, 12:44 AM
hey, great work by the way. :)
tea
steveguberman
10-01-2003, 09:19 AM
thanks everyone for their feedback...
Vincent, that caht program you built works nicely, very nicely. Is it all self contained (as far as the programming and so called back-end) or is there other programs it runs off of outside the swish program?
Is the Swish compatible with flash where you could open what you built in flash?
thanks again,
Steve
Vincent26381
10-01-2003, 09:25 AM
Thanks both :)
It's just the flash file, a php script that writes to the textfile (5 lines or so) and a php script that displays the whole textfile or just the last entry depending what the chat 'asks'.
While the actionscript is almost the same as flash MX both programs aren't compatible. :( It's just that I like this one a lot better because I work a lot faster with it (and it's a lot cheaper) ;)
SoCalNiceGuy
12-22-2003, 03:46 AM
love the teaconcepts.net/chat/ chatroom, i am looking to make somethin like that but with webcam n pm support maybe even profiles.
123fcserver
01-07-2004, 05:58 AM
A flash chat sample for you:
here (http://www.123flashchat.com/demo.html)
;)
Forms.Ge
06-10-2006, 05:30 PM
love the teaconcepts.net/chat/ chatroom, i am looking to make somethin like that but with webcam n pm support maybe even profiles.
hi
Forms.Ge
06-10-2006, 05:31 PM
IQ TEST FOR AMERICAN PILOTS TRY IT WWW.FORMS.GE
Forms.Ge
06-10-2006, 05:34 PM
:)
flashkit.com
Copyright WebMediaBrands Inc., All Rights Reserved.