go-casper
go-casper

Go 1.8 is going to support HTTP/2 server push. Server push allows us to send resources like CSS or JavaScript files before the client asks (so we can expect faster page rendering). As described on this post or this issue, one of the important things to use server push is to know when to push. Since it's waste of the network bandwidth (and cause negative effects on response time), you should avoid to push the asset which has already been cached by the client.

To solve these problem, H2O, a server that provides full advantage of HTTP/2 features, introduces CASPer. CASPer maintains a fingerprint of the browser caches (Golomb-compressed bloom filter) as a cookie, and cancels server-push if the fingerprint indicates the client is known to be in possession of the contents.

go-casper

The full documentation is available on Godoc.

NOTE1: This project is still a proof of concept and still under heavy implementation. API may be changed in future and documentaion is incomplete. This code should not be run in production. Comments are all welcome!

NOTE2: There is a draft by H2O author which defines a HTTP/2 frame type to allow clients to inform the server of their cache's contents 👏 This pacakage can be replace with it in future.

Example

Below is a simple example of usage.

You can find the complete example here.