Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/160308-chat-engine/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-845966
Share on other sites

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. 

Link to comment
https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846575
Share on other sites

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)

Link to comment
https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846578
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846589
Share on other sites

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'

Link to comment
https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846592
Share on other sites

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/160308-chat-engine/#findComment-846608
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.