Does anyone have any idea of how to create a PHP-based chatroom server? I'd like to dynamically make some channels, and not just one huge chat room for everyone. Also, it would be great to make it scalable. I was thinking of storing messages in a database and using ajax to retrieve messages, but it sounds kinda slow. Any better ideas?
I've made a chat in php and used ajax. If you don't design it right it could accidently create a denial of service where too many update requests come in. (I used an ajax chat app that I found and the server load shot up and the whole site was slow).
When I designed the chat I added.
. The server tells the browser when to update again, it uses sys_getloadavg() and slows the requests down if the server is slow
. Only send new info on every update, there's no need to send the last hours worth of chat every 5 seconds.
. I think the ideal solution is looking into socket connections where the server pushes the chat, so on every new message the server sends the message to every open chat connection. As far as I know it requires web server support, plus flash or browser support for sockets
well good job, where's your page?