Spook Posted December 21, 2007 Posted December 21, 2007 I have made a rather nice livechat application in php/mysql/ajax I have integrated it onto my website inside members profiles. If they are online the image appears where other members can click to send a livechat request That dumps a row in a mysql database. Ever 2 minutes, on the other persons homepage, ajax checks the database for requests. If it finds one, it starts the livechat between the two people. Great! Well, I want to go one better. If its livechat, having a 2 minute delay between requests is a real pain. I know web technology hasn't quite caught up with that yet so are limited, but Im wonderin what the best way to go about it is I have heard something about 'Server Push' or 'PHP Sockets' Basically, with msn, when a message is sent it literally is sent straight from them to you. The other persons msn client doesnt query a central server for messages every second. I know its not web language, but is this acheivable using any web languages. If not, what would you guys suggest Sure I could make the AJAX refresh every 30 seconds rather than 2 minutes, but sometimes there are 1000 people online. I dont want to blow my server up! Cheers ! Quote
Spook Posted December 22, 2007 Author Posted December 22, 2007 Can you elaborate Googling that gives me info about pop3 Quote
jollyrancher82 Posted December 22, 2007 Posted December 22, 2007 The problem with web based chat is there are no threads so to speak of so you can't have one thread sending data, and one thread receiving data. You could download CGI:IRC source and have a look how that does it. Quote
Spook Posted December 22, 2007 Author Posted December 22, 2007 Has it even been done before in php/mysql qith a backened pure php socket? Quote
jollyrancher82 Posted December 23, 2007 Posted December 23, 2007 Has it even been done before in php/mysql qith a backened pure php socket? I'm sure it has, it's not something I've looked into deeply. Quote
thork Posted December 23, 2007 Posted December 23, 2007 on the clients, I would consider flash, as it has got socket support from early versions, and for the server you could use php sockets. if your more comfertable with javascript you could try the flash bridge, and use javascript to make flash create a socket Socket connections in AS3 livedocs.adobe.com/labs/flex3/html/17_Networking_and_communications_5. html Socket class for JavaScript using Flash Player >= 6 bridge www.devpro.it/xmlsocket/ SocketJS Realtime Sockets in Javascript! The JS-Bridge to Flash' Socket API dev.dschini.org/socketjs/ www.aflax.org/ Quote
Spook Posted December 23, 2007 Author Posted December 23, 2007 Cheers guys I will check into that method Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.