Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, I have absolutely no idea why Web Sockets aren't just an initial HTTP request and then a protocol switch (Upgrade header); that would work for the vast majority of proxies and make cookies/same domain/etc work seamlessly.


From the web socket spec:

  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


Well, that explains my disbelief. Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: