{"id":13837956,"url":"https://github.com/aantron/hyper","last_synced_at":"2025-06-21T09:38:03.099Z","repository":{"id":52997464,"uuid":"437361189","full_name":"aantron/hyper","owner":"aantron","description":"OCaml Web client, composable with Dream [unannounced]","archived":false,"fork":false,"pushed_at":"2024-04-21T20:54:17.000Z","size":131,"stargazers_count":70,"open_issues_count":8,"forks_count":5,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-11T09:43:39.662Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aantron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"aantron"}},"created_at":"2021-12-11T18:38:51.000Z","updated_at":"2025-01-05T20:07:48.000Z","dependencies_parsed_at":"2022-08-30T09:20:52.831Z","dependency_job_id":"64882766-0f86-4504-8342-f99493a79c22","html_url":"https://github.com/aantron/hyper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aantron%2Fhyper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aantron%2Fhyper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aantron%2Fhyper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aantron%2Fhyper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aantron","download_url":"https://codeload.github.com/aantron/hyper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234833249,"owners_count":18893887,"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":[],"created_at":"2024-08-04T15:01:31.746Z","updated_at":"2025-01-20T17:53:57.758Z","avatar_url":"https://github.com/aantron.png","language":"OCaml","readme":"\u003ch1 align=\"center\"\u003eHyper\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\nStraightforward, full-featured Web client that composes with Dream.\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n```ocaml\nLwt_main.run begin\n  let%lwt response = Hyper.get \"http://google.com\" in\n  print_string response;\n  Lwt.return_unit\nend\n```\n\n\u003cbr\u003e\n\n*Note: the client is not actually full-featured yet :) This README is also an\nextremely rough sketch :) This repository is a work in progress*\n\nHyper is the client counterpart to [Dream][dream], the Web server framework.\nHyper uses the same types and the same programming model. Like Dream, Hyper\noffers one module, which features a bunch of easy-to-use functions. Also like\nDream, Hyper still exposes the underlying highly composable functions, for full\ncustomization.\n\n\u003cbr\u003e\n\n## Documentation\n\nAt the moment, Hyper offers only three main \"stable\" values:\n\n```ocaml\nHyper.get : string -\u003e string promise\nHyper.post : string -\u003e string -\u003e string promise\nHyper.websocket : string -\u003e websocket promise\n```\n\nThese support all the same Web protocols as Dream: HTTP/1, HTTP/2, TLS, and\nWebSocket, and they follow redirects. The protocols are selected using URI\nschemes:\n\n```ocaml\nHyper.get \"http://google.com\"\nHyper.post \"https://some.app/endpoint\" \"{}\"\nHyper.websocket \"ws://some.site/socket\"\n```\n\nYou can see early usage in the [examples][examples].\n\nThese are actually wrappers around a \"stack\" of `request -\u003e response promise`\nhandlers and client-side middlewares, but the elements of that stack are not\nmature enough to expose yet. They will eventually be exposed to quickly build\ncustom clients with any desired behavior.\n\nFor testing WebSockets, Hyper offers an interface similar to\n[the one in Dream](https://aantron.github.io/dream/#websockets):\n\n```ocaml\nHyper.send : websocket -\u003e string -\u003e unit promise\nHyper.receive : websocket -\u003e string option promise\nHyper.close_websocket : websocket -\u003e unit promise\n```\n\n[dream]: https://github.com/aantron/dream\n[examples]: https://github.com/aantron/hyper/tree/master/example\n\n\u003cbr\u003e\n\n## Composability\n\nA Hyper client and a Dream server have exactly the same type,\n`request -\u003e response promise`.\n\nThis means that the client's lowest layer can be implemented by swapping out\nconnecting over the network by a direct call to an in-process Dream server,\nwhich can be useful for no-network testing.\n\nConversely, a Dream server can pass the requests it receives to a Hyper client,\nthus acting as a proxy. Responses received from the proxy client can be directly\nreturned by the server to *its* client.\n\nIn all cases, all body streams and WebSockets get forwarded automatically as a\nside effect of the conventions followed by Hyper and Dream.\n\n\u003cbr\u003e\n\n## Roadmap\n\n- [ ] Restore [connection pooling and multiplexing](https://github.com/aantron/dream/blob/f69b95644a237be0aa3c9d3c6e29a7be32a5dbdb/src/hyper.ml#L76).\n- [ ] 🛑 Server certificate validation.\n- [ ] File uploads (multipart streams).\n- [ ] Cookie store.\n- [ ] Redirect cache.\n- [ ] Automatic decompression.\n- [ ] `wss://` (WebSockets over TLS).\n- [ ] Many miscellania.\n\n\u003cbr\u003e\n\n## Contact\n\nOpen an [issue](https://github.com/aantron/dream/issues), or visit...\n\n- #dream on the [Reason Discord](https://discord.gg/2JTYRq2rYh).\n- #webdev on the [OCaml Discord](https://discord.gg/sx45hPkkWV)\n- The [OCaml Discuss forum](https://discuss.ocaml.org/).\n\nHighlight `@antron` to poke @aantron specifically.\n\n\u003cbr\u003e\n\n## Contributing\n\nTo work on Hyper, clone Dream and Hyper into a single Dune workspace:\n\n```\nmkdir my-directory\ncd my-directory\ntouch dune-workspace\ngit clone --recursive https://github.com/aantron/dream.git\ngit clone https://github.com/aantron/hyper.git\ncd hyper\n```\n\n\u003cbr\u003e\n\n## Acknowledgements\n\nAs with Dream, Hyper makes extensive use of the http/af-like Web protocol stack\nby [Antonio Nuno Monteiro](https://github.com/anmonteiro).","funding_links":["https://github.com/sponsors/aantron"],"categories":["OCaml","\u003ca name=\"OCaml\"\u003e\u003c/a\u003eOCaml"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faantron%2Fhyper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faantron%2Fhyper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faantron%2Fhyper/lists"}