Jump to content

instant messaging


chiprivers

Recommended Posts

I want to create a simple instant messaging script for my daughter to chat with her friends online within a secure enviroment that I can control.  I can build the majority of this using PHP and MySQL and wondering how I can make it update with new messages as they are ready? I have googled this but all I can find is full scripts, all I need is to know is the bit to get the messages in real time!

Link to comment
Share on other sites

Hmm, sounds like if I gave you a nudge, you'd instantly would be able to follow up.

 

Check up on AJAX and PHP. AJAX uses javascript calls to PHP pages to obtain data. It's a very simple, clean method that can be used to retrieve new messages by having the PHP page run the query and return any new messages.

Link to comment
Share on other sites

You have to have a refresh value for the chat window, since PHP is server-side. The refresh searches the database for new messages based on a timestamp. This would be fairly complicated logic and programming, not to mention mission-critical. You would need to use document.write to really do this smoothly.

 

The other way is to pull all messages, and send n number of them to the chat window. Messages are removed from the database every n number of minutes so that only recent messages are in there. This is certainly not very efficient, but workable.

 

I feel you may be re-creating the wheel here, as there are TONS of free IM/Chat scripts around, including some nice Flash ones. PHP developed chat screens tend to be poor environments, since you have to constantly refresh the page, which unless the user has navigation clicks turned off in their settings, produces a click every 5 or 10 seconds depending on refresh rate. You really need AJAX or Flash to get around all the caveats associated with server-side chat scripts.

 

PhREEEk

Link to comment
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.