I've been moving away from my comfort zone in PHP/MySQL because the syntax/encapsulation/procedural stuff can get frustrating.
Last week, I started played around and followed some tutorials to use Node.js/Socket.IO to create a live chat application. Up until this point, I've never done anything with WebSockets, and they seem really cool -- instant communication between server and client is awesome.
Now, forgive my lack of understanding here, but HTTP is set up so that you aren't supposed to be able to keep connections open between client and server -- and my rudimentary understanding of Comet is that it forces the connection to remain open by never terminating the write stream and just sending NUL bytes. This sounds... server-intensive.
How do WebSockets work, then? If I had a couple hundred people on my chat app at once, wouldn't the server be overloaded? When I use PHP/MySQL on a server, the server only processes one request at a time -- and if I were to use AJAX and poll, say, every one second, I imagine that it would escalate quickly as you'd have thousands of requests a minute.
My question is, do WebSockets scale for large applications? Is it practical without having a really high-bandwidth server?
I guess it comes down to: is there a significant server load/user experience difference between AJAX polling at a frequent interval, Comet, and WebSockets?
Thanks!