Jump to content

Loving PHP Websockets, but is it worth?


Monkuar

Recommended Posts

So I've been using this websocket: http://code.google.com/p/phpwebsocket/

 

Love it because I don't know javascript as well as I do PHP. (Absolutely hated learning socket.io and their style of javascript, just gave up on it).

 

Anyways, I'm using MYSQL with the php socket for the chatroom authentication with my forum. (Sending the cookie values to the socket, to authenticate user). It's working fine and the MYSQL only get's called for each time a user is authenticated (logged into the websocket). The usernames and sessions are actually stored in a Temporary array which is nice. So only on authentication it queries the database for the authentication itself. (Very lightweight and a smart way for a chat system).

 

My question is, how does this compare to a node.js and socket.io server with a MYSQL plugin, etc? seems like that route would actually be more intensive?

 

I don't even need to include the socket.io.js for the client / PHP setup I have here as well. This way seems lightweight in my opinion (clientside) but not sure on the server end.

 

Thoughts? 

 

TLDR: Running a PHP Websocket as compared to a node.js/socket.io server with mysql plugins the same in performance? Is it even noticeable? Should I be worried?

 

Edit: Disregard  compatibility issues too.  ( Using this http://tools.ietf.org/html/rfc6455 protocol is fine for my audience and intentions )

Edited by Monkuar
Link to comment
Share on other sites

My question is, how does this compare to a node.js and socket.io server with a MYSQL plugin, etc? seems like that route would actually be more intensive?

I'm not sure how you came to this conclusion; from every benchmark I've ever seen, node.js beats PHP in comparable situations. Especially in this kind of scenario. If you've performed any kind of benchmarking (results?) and have seen PHP seem favourable, you should be providing specifics.

 

Love it because I don't know javascript as well as I do PHP. (Absolutely hated learning socket.io and their style of javascript, just gave up on it).

'Their style' is just the same as any other node application/library. It takes time to adapt to writing the majority of your code asynchronously, in order to get the best out of node. If you've been writing it in a way that goes against its nature, it's not hard to imagine why you're not seeing the performance others are seeing.

Link to comment
Share on other sites

I'm not sure how you came to this conclusion; from every benchmark I've ever seen, node.js beats PHP in comparable situations. Especially in this kind of scenario. If you've performed any kind of benchmarking (results?) and have seen PHP seem favourable, you should be providing specifics.

 

 

'Their style' is just the same as any other node application/library. It takes time to adapt to writing the majority of your code asynchronously, in order to get the best out of node. If you've been writing it in a way that goes against its nature, it's not hard to imagine why you're not seeing the performance others are seeing.

 

 

Well, I am using that php websocket server I linked above and I love it. It's very easy to transfer my existing game code that is written in PHP over to the server that is also written in PHP.  How big is the performance increase from using node.js instead of a php websocket server? Is it noticeable? Is it only worth it, if you're having like a thousand concurrent users connected, etc, etc?

 

Because I DO not and quite frankly, cant switch to node.js because I am not familiar with javascript as much as I am with PHP. I love php way more and love this php websocket server, but not sure if a php websocket server can be used in production.

Edited by Monkuar
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.