HTTP/2 and WebSocket

With HTTP/2 marching towards production environments, you might be wondering how WebSocket fits in. The HTTPbis working group was thinking about that too:

The WebSocket protocol enables two-way communication between a client running untrusted code in a controlled environment to a remote host that has opted-in to communications from that code. Since it requires one TCP connection for every WebSocket connection, having multiple WebSocket connections between the same client and the same server is inefficient. On the other hand, HTTP/2 specifies a fast, secure, multiplexed framing protocol. This document provides bi-directional multiplexed communication by layering WebSocket on top of HTTP/2.

From draft-hirano-httpbis-websocket-over-http2-01.

The draft expired back on February 13, 2015 and I haven’t seen any other significant discussions in this area. At this point there doesn’t appear to be any momentum to come up with a way to leverage HTTP/2 in future versions of the WebSocket protocol.

justice.js

From Jason Ormond comes justice.js:

A performance metric bar with a streaming FPS graph.

It shows:

  • TTFB ( Time To First Byte )
  • DOM Interactive
  • DOM Complete
  • First Paint
  • Page Load
  • Number of Requests
  • FPS ( Frames Per Second )

Here is a screenshot of it from a page load of josephscott.org:

justice

I like that it has budget options for each number. It then sets the color of each metric based on that budget, making it easy to tell if you are over/under at a glance ( > 80% budget: Yellow ).

Works well as a bookmarklet too.

WebAssembly

Back in June Brendan Eich announced WebAssembly:

WebAssembly, “wasm” for short, .wasm filename suffix, a new binary syntax for low-level safe code, initially co-expressive with asm.js, but in the long run able to diverge from JS’s semantics, in order to best serve as common object-level format for multiple source-level programming languages.

More from Luke Wagner and Eric Elliott. Details are being hashed out in the design documents.

The big question in my mind is performance. Porting over various native libraries to WebAssembly ( assuming a future where this all more or less works ) will only be compelling if they can run at speeds comparable to native apps. It will also need to balance that with battery life.

If you were looking for a moonshot project, this will be a fun one to watch.

Painfully Slow

Gabor Lenard after three weeks of painfully slow Internet access:

Here’s the three most important things that I became aware of during this time as a web developer:

1. Some sites never loaded
2. On some sites the text was invisible for a frustratingly long time
3. Well-designed apps worked wonderfully

I fear that #2 is becoming an increasingly common experience as more sites include custom fonts. The HTTP Archive currently reports 56% of sites use custom fonts. Not uncommon for sites to load 100KB or more of fonts.

Completely Unpredictable

Tim Kadlec on Thriving in Unpredictability:

The only thing I control is my server environment. That’s it. Everything else is completely unpredictable.So when I’m building something, and I want to make it robust—to make it resilient and give it the best chance it has to reach across this complicated mess full of unpredictability—I want to take advantage of the one thing I control by letting my server output something usable and as close to working as possible.

While Tim was talking about the web, this is the same line of thinking that goes into native apps. Being able to control both sides dramatically changes your assumptions about what you can get away with.

Speaking at UPHPU: Measuring Web Performance

On Thursday 20 August 2015 I’ll be speaking at the Utah PHP Users ( UPHPU ) group on ‘Measuring Web Performance using WebPageTest’.

I’ll cover the features and options provided by WebPageTest, along with tips on how to review the results.

The meeting starts at 7pm, the location is:

Needle Inc.
14864 Pony Express Road
Bluffdale, UT 84065

Anyone is welcome to attend.