WebSocket is a protocol providing full-duplex communications channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocket API in Web IDL is being standardized by the W3C. Technical overview Browser implementation WebSocket protocol handshake To establish a WebSocket connection, the client sends a WebSocket handshake request, for which the server returns a WebSocket handshake response, as shown in the following example::section 1.2 Client request: GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw== Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 13 Origin: Server response: HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk= Sec-WebSocket-Protocol: chat Note that each line ends with an EOL (end of line) sequence, \r\n.
HTTP StreamingFrom Ajax Patterns Please see discussion page for an alternate approach to HTTP streaming from what is listed below! Evidence: 1/3 Tags: Comet Connection Duplex Live Persistent Publish Push RealTime Refresh Remoting RemoteScripting Stateful Stream TwoWay Update APE Ajax Push Engine How can the browser receive events and responses from the server? The state of many web applications is inherently volatile. Stream server data in the response of a long-lived HTTP connection. "Page Streaming" involves streaming the original page response. For example, the server can initially output a div which will always contain the latest news. print ("<div id='news'></div>"); But instead of exiting, it starts a loop to update the item every 10 seconds. <? That illustrates the basic technique, and there are some refinements discussed below and in the Design Decisions. "Page Streaming" means the browser discovers server changes almost immediately. How long will you keep the connection open? Caplin Liberator WebSync