Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WebSockets - Today, in the Past, in Future and in Production.

WebSockets - Today, in the Past, in Future and in Production.

In the given talk I cover interesting fact about the protocol which provides HTTP bidirectional communication. Starting with the past state of web sockets and their implementation I explain the protocol step by step, present my own stream based WebSocket implementation and compare it to present challengers. To the end I talk about my personal experience with WebSockets and how I predict the future of them.

Bodo Kaiser

July 02, 2014
Tweet

More Decks by Bodo Kaiser

Other Decks in Programming

Transcript

  1. HTTP Server Client GET / HTTP/1.1 Host: localhost Accept: */*

    HTTP/1.1 200 OK Content-Type: text/plain Content-Length: 12
  2. WS Server Client GET / HTTP/1.1 Host: localhost Upgrade: websocket

    Connection: Upgrade Sec-WebSocket-Key: … Sec-WebSocket-Version:13 HTTP/1.1 101 Switching… Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: …
  3. Frame Encoding 1000 0001 0000 0101 0100 1000 0110 0101

    0111 1001 Payload Header H e y F I N R S V OP CODE M A S K LENGTH Extended Length Masking
  4. WebSockets in node.js socket.io by learn boost fallback support, high

    level api (e.g. events) ! ws by einaros „fastest“ websocket implementation
  5. Walve - socket.io by learn boost not working, using xhr

    fallback all the time, cannot read code for PR ! - other ws implementations awful API design, also bad to read 1. Follows node’s core conventions 2. Uses node’s TransformStreams 3. Written in readable JavaScript
  6. Performance (Large Image) Large Image Werteachse 2000,000 2400,000 2800,000 3200,000

    3600,000 4000,000 4400,000 4800,000 5200,000 5600,000 6000,000 ws walve
  7. Examples Messenger ! Simple WebSocket Chat with Image support. Nearby

    ! Realtime Tracking with Google Maps and Geolocation. ! http://github.com/bodokaiser/messenger http://github.com/bodokaiser/nearby
  8. Thanks and Q&A Follow me on twitter @bodojs ! Star

    my projects on github github.com/bodokaiser