I think the bit outstanding question is about scale.
The comet connection requires 2 keep-alive HTTP connections to make a full-duplex connection. So obviously a single socket connection doubles the number of users a single box can handle - does it actually scale that way?? Don't know.
You've also got to wonder about the extra overhead of running deflate on everything that you send with the XHR version of the code, and why there couldn't be some sort of compression applied to the packets sent through WebSocket if it is a really big deal.
Also, obviously, the smaller your send/receive, the better the improvement that your websocket code would see over XHR.
I can imagine an application of websockets where you open multiple sockets and send a number of constantly updating data-streams from the server.
A lot of articles seem to imply that websockets is simply XHR 2.0, and I'm sure it will be used as such for a while.
But it seems to me that there are certain things that you can do with this that simply cannot be done efficiently with other technology.
(Imagine being able to smoothly track a mouse cursor or watch another person edit a document in real time, how would you do that with XHR?).
>> "or watch another person edit a document in real time, how would you do that with XHR?"
Works fine on Etherpad.
Having said that, I agree, the lag with WebSocket is likely to be a less. Hopefully WebSocket will get the ability to do deflate/gzip soon as well. That would make it a very clear winner.
Really? You're still sending packets, so instead of sending roughly 1k of data, you're going to send a packet with roughly 1 byte of information on each keystroke?
What I'd really like to see is the breakdown of the number of packets sent as opposed to the number of bytes. I doubt the difference would be as significant.
I'm a Chrome loving geek, but I'm far outnumbered by the non-technical, non-geeks that I've converted to Chrome based on its superior security and stability.
Among my friends, that's step 1 when you get roped into doing family tech support anymore: remove the IE shortcuts, install Chrome. Only sometimes changing the chrome shortcut to the IE icon...
I have been playing with web workers (http://github.com/revis/Really-Cloudy) and one thing that worried me was the number of people with capable browsers. From your data it looks like that isn't a problem for technical audiences.
What I don't get is why more people haven't been using Flash's socket support (XMLSocket, and the more general-purpose flash.net.Socket in AS3) for this sort of thing. Flash is installed on practically all web browsers, and you can still write the rest of your app in JS if you want by using ExternalInterface.
For extra credit, you could probably write a WebSocket implementation IN Flash using these techniques. Anyone on it?
There are a lot of simple flash shims out there -- I'm using one for my app, with everything else written in javascript. For me, switching to websocket would be more or less ceremonial rather than practical.
20 comments
[ 3.0 ms ] story [ 49.8 ms ] threadThe comet connection requires 2 keep-alive HTTP connections to make a full-duplex connection. So obviously a single socket connection doubles the number of users a single box can handle - does it actually scale that way?? Don't know.
Also, obviously, the smaller your send/receive, the better the improvement that your websocket code would see over XHR. I can imagine an application of websockets where you open multiple sockets and send a number of constantly updating data-streams from the server.
A lot of articles seem to imply that websockets is simply XHR 2.0, and I'm sure it will be used as such for a while.
But it seems to me that there are certain things that you can do with this that simply cannot be done efficiently with other technology.
(Imagine being able to smoothly track a mouse cursor or watch another person edit a document in real time, how would you do that with XHR?).
Works fine on Etherpad.
Having said that, I agree, the lag with WebSocket is likely to be a less. Hopefully WebSocket will get the ability to do deflate/gzip soon as well. That would make it a very clear winner.
On etherpad there is a lag and updates get chunked.
With websockets you could do it by the keystroke with little to no overhead.
What I'd really like to see is the breakdown of the number of packets sent as opposed to the number of bytes. I doubt the difference would be as significant.
Browser usage on Mibbit main client (Snapshot):
Chrome has really grown at an astounding rate in the webapp usage world at any rate.Among my friends, that's step 1 when you get roped into doing family tech support anymore: remove the IE shortcuts, install Chrome. Only sometimes changing the chrome shortcut to the IE icon...
I have been playing with web workers (http://github.com/revis/Really-Cloudy) and one thing that worried me was the number of people with capable browsers. From your data it looks like that isn't a problem for technical audiences.
Atleast some webapp makers and users don't care about IE.
Did you write your own http server/library or are you using an existing one for the current Comet implementation?
I really hope someday to open source it sometime. If only to show people that development in Java doesn't have to be horrible.
For extra credit, you could probably write a WebSocket implementation IN Flash using these techniques. Anyone on it?