{"id":16348221,"url":"https://github.com/romainmenke/pusher","last_synced_at":"2025-03-23T00:33:04.910Z","repository":{"id":57511888,"uuid":"77405183","full_name":"romainmenke/pusher","owner":"romainmenke","description":"golang : HTTP2 Push Handler collection","archived":false,"fork":false,"pushed_at":"2018-06-15T14:13:40.000Z","size":777,"stargazers_count":15,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-15T19:43:50.033Z","etag":null,"topics":["go","golang","http2","http2-push"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/romainmenke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-26T20:22:28.000Z","updated_at":"2019-11-28T04:20:45.000Z","dependencies_parsed_at":"2022-08-31T06:40:28.364Z","dependency_job_id":null,"html_url":"https://github.com/romainmenke/pusher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romainmenke%2Fpusher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romainmenke%2Fpusher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romainmenke%2Fpusher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romainmenke%2Fpusher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romainmenke","download_url":"https://codeload.github.com/romainmenke/pusher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245040235,"owners_count":20551297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","http2","http2-push"],"created_at":"2024-10-11T00:50:10.254Z","updated_at":"2025-03-23T00:33:04.268Z","avatar_url":"https://github.com/romainmenke.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/romainmenke/pusher.svg?branch=master)](https://travis-ci.org/romainmenke/pusher)\n[![Go Report Card](https://goreportcard.com/badge/github.com/romainmenke/pusher)](https://goreportcard.com/report/github.com/romainmenke/pusher)\n[![codecov](https://codecov.io/gh/romainmenke/pusher/branch/master/graph/badge.svg)](https://codecov.io/gh/romainmenke/pusher)\n[![GoDoc](https://godoc.org/github.com/romainmenke/pusher?status.svg)](https://godoc.org/github.com/romainmenke/pusher)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://cloud.githubusercontent.com/assets/11521496/24838540/070645b2-1d4a-11e7-9c39-900371d5fda3.png\" width=\"250\"/\u003e\n\u003c/p\u003e\n\n# H2 Push Handlers\n\n**pusher** is a collection of `http.Handler`'s to easily enable HTTP2 Push.\n\n- [link](https://github.com/romainmenke/pusher/tree/master/link) : a H2 Push handler based on `Link` headers.\n- [casper](https://github.com/romainmenke/pusher/tree/master/casper) : CASPer handler.\n- [rules](https://github.com/romainmenke/pusher/tree/master/rules) : Simple rules to generate `Link` headers or pushes.\n- [parser](https://github.com/romainmenke/pusher/tree/master/parser) : html body parser -\u003e generates Push Frames / Link Headers for you.\n\nCheckout the sub-packages for more details.\n\n----\n\nYou probably already saw this code snippet from the [go blog](https://blog.golang.org/h2push) :\n\n```go\n    http.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n        if pusher, ok := w.(http.Pusher); ok {\n            // Push is supported.\n            if err := pusher.Push(\"/app.js\", nil); err != nil {\n                log.Printf(\"Failed to push: %v\", err)\n            }\n        }\n        // ...\n    })\n```\n\nBut obviously you don't want to hard code pushes for all your assets, especially in case of a proxy. That is where these handlers come in. Just choose the right one for the job.\n\n### Proxy Server\n\nIf you run a proxy server and want to enable H2 Push for all requests coming through, you implement the `link` pkg Handler and add `Link` headers on the source server. This approach is based on how Cloudflare enables H2 Push.\n\n### Client Side Rendered\n\nClient Side Rendered websites often have known critical assets like the js bundle. In this case it makes sense to have a couple of rules for which assets to push for a certain path. This is what the `rules` pkg does. It adds `Link` headers or sends Pushes depending on your setup based on simple rules.\n\n### Server Side Rendered\n\nA Server Side Rendered website with a CMS doesn't have known critical assets at deploy time. The `parser` pkg reads the first 1024 bytes from every html response and adds `Link` headers or sends Pushes depending on your setup.\n\n----\n\nThe Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromainmenke%2Fpusher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromainmenke%2Fpusher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromainmenke%2Fpusher/lists"}