Jump to content

Recommended Posts


hi,
I am trying to create a chat room in PHP.. I tried an open source PHP121 chat that uses AJAX. I could understand the working but, the thing that I disliked was the use of database to store messages between users.. I think, it would not be a good practice to access db for each message that is forwarded to the users chatting.. (it may create too many db connections and many transactions simultaneously when the more than 100 users chatting at same time.. I dont know, if my concept it clear .. plz elaborate, if I am wrong)..
Now, the next step I tried was to use XML to store and retrieve messages but this time, I was not able to find the DOM API.. (if anybody knows, plz help me).
My next step was to use simple text file to store messages but then I stumble upon the problem of multiple users accessing (read/write) 1 file at the same time..

I am still not sure, which is the best method to incorporate a chat system (1 to 1 chat only) in PHP..
Should I use Socket programming in PHP ?
I found this article recently posted here "http://www.devshed.com/c/a/PHP/An-Introduction-to-Sockets-in-PHP/".

Any help would be greatly appreciated..
thanks
Edit/Delete Message
Link to comment
https://forums.phpfreaks.com/topic/10320-chat-system-in-php/
Share on other sites

If its 1 on 1 chat using ajax I dont see why you need to store the messages anywhere, however if needed a database (mysql) would be fine.

As for XML (as a storage mechanism) , the DOM has nothing to do with it.

Sockets are great if you want / need your own proticol, but in a http (web) environment there not needed.
Link to comment
https://forums.phpfreaks.com/topic/10320-chat-system-in-php/#findComment-38475
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.