Erlang Creator Joe Armstrong Wants to Ditch AJAX, Loves Chrome's New Web Sockets
groups.google.com
groups.google.com
The interesting part is this:
Currently, we use XHR long polling, keep alive. Basically a raw socket with some HTTP header spam mixed in.
On the plus side, we can deflate/gzip the contents (unfortunately not across messages, but still does well). But on the negative, the HTTP headers are often about the same size or larger than the contents.
So, webSocket will improve the situation, in that there won't be HTTP header spam. Also we'll be able to use a single connection instead of two (One for sends, one for recvs). On the downside, there also won't be any deflate/gzip (Unless implemented in js etc).
The other big bonus with WebSocket is you can connect to a different port. Something that's not possible (For some idiotic reason) with XHR.
It'll be interesting to see which one wins :)
Pretty cool to see this in Chrome, I thought Firefox would be first to implement it.
If you wade through the thread, you'll see that someone posted that Firefox/Mozilla had it in trunk for nearly/over a year. Didn't check myself though.
This isn't going to be another SIP, is it? 'Yes we've all agreed on this protocol, off you go and use it. NAT? What's NAT? Is it important?'
This is conjecture, however, as I've yet to research RHTTP.
EDIT: it seems my instinct on proxying was incorrect, other posts imply that the 'Upgrade' header is used. I'm a little surprised that this is widely supported by proxies. I suppose the proxy just keeps the connection open if there's no specified Content-length. Timeouts spring to mind as a potential issue.
But none of these is needed for websockets to work.
Such variants have their places.
(No mention of reverse HTTP in http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-...)
Edit: Disregard that I need coffee. (Aka, I'm the one confused about Opera's builtin webserver thing.)
Personally, I'd rather someone just write a minimal interface (i.e. not Bayeux) to long-running Comet connections using XMLHTTPRequest. It should be trivial after that to make it compatible with the nice API that WebSocket has exposed.
the protocol is simple to implement (10 lines server, 10 lines client for an echo server), and is a completely natural extension to traditional socket programming.
I am pretty excited by it.
Exactly backwards. Comet is a thick, ugly layer that is way more complex than sockets. It adds staggering resource overhead to the real abstraction you want; it will in the end be way easier to support a ton of WebSockets than a ton of Comet connections. (That may not be true of pre-optimized implementations, but it will be true of final implementations.)
You don't add Socket support to your HTTP server... you have to add HTTP support to your (TCP) Socket server!
This is the minimal interface; it's Comet that's the hacked up hideous ugly kludge that should never ever have been born because when that dude at Microsoft went to add XMLHttpRequest, if he'd had a clue what that bastard monstrosity would become, he would have created WebSockets right then instead. I don't blame him, it would have taken a lot of vision at the time to understand that. But this is what we should have had from day one, and Comet should never have been.
We have spent a truly astonishing amount of time in the web world deep in the woods, failing to take advantage of simple things that have been known since the 1960s. We've been in the woods so long that people have come to mistake the hacks for the right answer. They're still hacks. Sockets are the not-a-hack. (Though personally I'd still have gone for real sockets.)
Furthermore, you will find, eventually, that WebSockets perform better, both on the client and the server, and there is no amount of jQuery magic that can change that, because the suckiness is fundamental to the nature of Comet. Which again emphasizes the point that it is Comet that is the layer of crap, not web sockets. There's also a lot less that can go wrong since there's a lot less code, and again, slathering on more code on top of Comet can't fix that.
Besides which, the X in AJAX is JSON often enough nowadays.
I understand there are security implications, but I wish browser would stop creating prohibitively strict restrictions on web applications and make a somewhat sensible way too elevate permissions
(same origin model, access to the clipboard, etc etc)
Websockets + Erlang... nice.
I thought this was the same problem Flash sockets had, traffic being blocked.
The protocol has two parts: a handshake, and then the data transfer.
The handshake from the client looks as follows:
GET /demo HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: example.com
Origin: http://example.com
WebSocket-Protocol: sample
The handshake from the server looks as follows:
HTTP/1.1 101 Web Socket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
WebSocket-Origin: http://example.com
WebSocket-Location: ws://example.com/demo
WebSocket-Protocol: sample