Jump to content

Chat Room Idea


DragonFire-N[R]

Recommended Posts

I've been trying to think of the best way to build a PHP based chat room. Obviously a push method would work the greatest but I have been unable to find any such techniques using PHP so this is the only alternative I can think of.

 

When a user logs in to the chat, a file is created in a secure directory on the server for the user. This file will store messages to be sent to the user. Each time someone sends a message to the chat, the message is inserted into every user's file. Then, using AJAX, the user in chat will "reload" the chat every few seconds, which will simply access a PHP script that reads the file, sends it to the user, then truncates the file contents to zero.

 

My concern is obviously the high frequency of server loads to access the chat file, but this is why I would try to minimize the server's effort for retrieving chat content and focus the efforts more on sending messages since this action is done less often.

 

I'm looking for suggestions on what would be best to keep the system efficient... maybe some ideas of headers to send which may help with optimization. Thank you for your time.

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.