background preloader

WEB SOCKETS

Facebook Twitter

WebRTC. The WebSocket API. Abstract This specification defines an API that enables Web pages to use the WebSocket protocol (defined by the IETF) for two-way communication with a remote host.

The WebSocket API

Status of This document This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the most recently formally published revision of this technical report can be found in the W3C technical reports index at If you wish to make comments regarding this document, you can enter feedback using this form: You can also e-mail feedback to public-webapps@w3.org (subscribe, archives), or whatwg@whatwg.org (subscribe, archives). Implementors should be aware that this specification is not stable. The latest stable version of the editor's draft of this specification is always available on the W3C CVS server and in the WHATWG Subversion repository.

E-mail notifications of changes Commit-Watchers mailing list (complete source diffs): WebIDL. A WebSocket Community. A WebSocket Community. Ratchet - PHP WebSockets. Nicokaiser/php-websocket. WebSocket. WebSocket is a protocol providing full-duplex communications channels over a single TCP connection.

WebSocket

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[edit] Browser implementation[edit] WebSocket protocol handshake[edit] 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:[9]: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.

Proxy traversal[edit] Dinahmoe – Adaptive Music And Interactive Sound Design. Apresentando WebSocket: trazendo soquetes para a web. O problema: conexões de baixa latência de cliente-servidor e servidor-cliente A web tem sido construída com base no conhecido paradigma de solicitação/resposta de HTTP.

Apresentando WebSocket: trazendo soquetes para a web

Um cliente carrega uma página da web e, em seguida, nada acontece até que o usuário clique na próxima página. Por volta de 2005, o AJAX começou a deixar a web mais dinâmica. Mesmo assim, toda a comunicação HTTP era direcionada pelo cliente, o que exigia interação do usuário ou sondagem periódica para carregar novos dados do servidor. No entanto, todas essas soluções compartilham um problema: elas carregam a sobrecarga de HTTP, que não é adequada para aplicativos de baixa latência. Apresentando WebSocket: trazendo soquetes para a web A especificação WebSocket define uma API que estabelece conexões de "soquete" entre um navegador da web e um servidor. Primeiros passos Para abrir uma conexão WebSocket, basta chamar o construtor WebSocket: var connection = new WebSocket(' ['soap', 'xmpp']); Observe ws:.

Comunicação com o servidor. WebSocket Protocol Registries.