Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP sockets worth it?

I am just getting started in using sockets to communicate to my Flex application as I require fast communication between the client and my server. I had a look at PHP sockets, but as PHP wasn't made to be run on a server in that way (you can, but I get the feeling it is frowned upon) I am not sure whether PHP is the best method of communicating with Flex using sockets.

My application requires the use of fast communication to the server as it will incorporate features such as private chat to other users, and remote control of the flex client from the server.

Should I use PHP sockets in my situation, or should I find an alternate language or even an alternative to sockets? My worry is that I shall start using PHP sockets, but it won't be able to cope under the load. Speed could also be an issue when using PHP.

Edit:

Thanks for the answers, it is much appreciated. As I can gather, PHP is stable when it comes to the use of sockets, but the language was only designed to be used in a request/response environment as Benson said.

Thanks to Cornel, a great alternative for my situation in using Flex with sockets was pointed out as being BlazeDS, using Java instead of PHP.

like image 750
Joel Kennedy Avatar asked Sep 12 '10 16:09

Joel Kennedy


1 Answers

Defining your own protocol over plain sockets in order to implement messaging and remote communication will take a significant amount of time - even for the basic messaging features. My suggestion is to use a server like BlazeDS if possible, you do not have to reinvent the wheel.

Yes, theoretically your application will perform faster if the protocols are optimized for your particular uses cases, but it will cost you a lot in development time.

like image 117
Cornel Creanga Avatar answered Sep 28 '22 06:09

Cornel Creanga