Monkuar Posted December 3, 2014 Share Posted December 3, 2014 (edited) 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 December 3, 2014 by Monkuar Quote Link to comment https://forums.phpfreaks.com/topic/292854-loving-php-websockets-but-is-it-worth/ Share on other sites More sharing options...
Monkuar Posted December 4, 2014 Author Share Posted December 4, 2014 24 hour bump. Someone please chime in on this for me? Pro's and Cons of a PHP Websocket as compared to node.js? Quote Link to comment https://forums.phpfreaks.com/topic/292854-loving-php-websockets-but-is-it-worth/#findComment-1498419 Share on other sites More sharing options...
Adam Posted December 6, 2014 Share Posted December 6, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/292854-loving-php-websockets-but-is-it-worth/#findComment-1498694 Share on other sites More sharing options...
Monkuar Posted December 11, 2014 Author Share Posted December 11, 2014 (edited) 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 December 11, 2014 by Monkuar Quote Link to comment https://forums.phpfreaks.com/topic/292854-loving-php-websockets-but-is-it-worth/#findComment-1499242 Share on other sites More sharing options...
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.