YourNameHere Posted May 30, 2009 Share Posted May 30, 2009 Where can I start learning to write a chat engine that can be affected by php methods? All of the ones I have found online premade cant be used for what I need. (Besides, I'd rather write my own). Basically, what I need is a chat that has buttons next to it the when one is pushed will write something into the chat window. I.e "$username does this" or "$username says that...". I am not asking for it do be written for me, I just need to know a good site that explains how chat engines are made. all searched have resulted in ??? only. thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/160308-chat-engine/ Share on other sites More sharing options...
Michdd Posted May 30, 2009 Share Posted May 30, 2009 I recently started writing my own chat engine, although it includes many more features. If you want you can see it @ http://imagechat.us.to (Don't click the ImageDump, may contain adult material (user-uploaded)). It's still pretty new. I didn't use any tutorial, but I created it using AJAX/Php. If you're interested in making something similar you should probably learn the basics of AJAX first. Quote Link to comment https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-845966 Share on other sites More sharing options...
YourNameHere Posted June 1, 2009 Author Share Posted June 1, 2009 ok, I read up on the basics and it seems fairly easy to write ajax code, but is this the best method? I see a lot of flash chats (I assume to avoid the annoying refresh) but am a complete novice with flash, so php would be easier for me. Quote Link to comment https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846569 Share on other sites More sharing options...
.josh Posted June 1, 2009 Share Posted June 1, 2009 The point of AJAX is to not make a request for an entire page, so you wouldn't have the "annoying refresh." There's only really 2 reasons why you would choose flash over AJAX based: 1) if you are wanting to really indulge with the graphics, 2) avoid issues with javascript being disabled. But, people could just as easily not have their browser set to run flash apps, so that kind of counters #2, so overall it really boils down to how heavy you are looking to make it, graphically. The back-end (php) would be virtually the same either way, so its a question of whether you want to learn the js/AJAX way or the flash way. Quote Link to comment https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846575 Share on other sites More sharing options...
Michdd Posted June 1, 2009 Share Posted June 1, 2009 Well, isn't it like impossible to make something really 'live' with Ajax? Because for it to be as liveas possible would it have to check for updates very often? Say once a second, I'm not exactly sure but with my chat engine it seems like that might be a little excessive when there are a decent amount of active users (although this isn't completely tested/confirmed) Quote Link to comment https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846578 Share on other sites More sharing options...
.josh Posted June 1, 2009 Share Posted June 1, 2009 yes, it needs to constantly send a request for updated info, but you have to do the same thing with flash. Quote Link to comment https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846586 Share on other sites More sharing options...
YourNameHere Posted June 1, 2009 Author Share Posted June 1, 2009 The point of AJAX is to not make a request for an entire page, so you wouldn't have the "annoying refresh." I guess my reservation about AJAX is bandwidth. it seems like flash would use less, correct? But I suppose it is the same either method. With as much user activity as I would presume this application would get, it might be easier to acheive the desired end result with Ajax, as I am more familier with it than flash. Thanks for the food-for-thought guys. I will continue reading up on ajax and hopefully knock this out. Quote Link to comment https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846589 Share on other sites More sharing options...
Michdd Posted June 1, 2009 Share Posted June 1, 2009 yes, it needs to constantly send a request for updated info, but you have to do the same thing with flash. It depends on how you're doing it, really. There are methods that wouldn't need to constantly send requests, more advanced though. Including Java (not sure if always) using sockets. On a side note, is there any way to optimize the updating process? I optimized like every part of my source and yet it seems like with even an average amount of active people it would put a lot of strain. It currently sends a request for updating every 1 second. I know popular forum mods using Ajax for a chatbox update every 5 seconds, so I'm just curious if it's practical at making something in Ajax that's more 'live' Quote Link to comment https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846592 Share on other sites More sharing options...
.josh Posted June 1, 2009 Share Posted June 1, 2009 I am nowhere near expert on flash but I would assume that it would send the same headers as any other language sending a request (ie- AJAX), and the data itself would certainly be the same. In general though, the client will not know that content has been updated unless it makes a request to the server, and that's all there is to it. Not really a java dude either but if you're able to make an applet that can open a socket, then that might be more efficient. Actually, now that I think about it, I vaguely remember possibly reading somewhere or other that more recent versions of actionscript might actually support using sockets. Regardless though, I still say "might" be more efficient, because it's a trade-off. You have a persisting socket instead of a one-time-use socket (which is pretty much what an http request is) yes, but then you have to do a lot of extra work to ensure data is being sent/received properly, in the right order, etc... or else you will end up with a big mess on your hands. Quote Link to comment https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846608 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.