{"id":18720482,"url":"https://github.com/stiffstream/beast-cppcon2018-vs-restinio","last_synced_at":"2025-07-22T10:35:47.911Z","repository":{"id":92244846,"uuid":"207589743","full_name":"Stiffstream/beast-cppcon2018-vs-restinio","owner":"Stiffstream","description":null,"archived":false,"fork":false,"pushed_at":"2019-09-10T15:35:49.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-28T11:28:19.688Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Stiffstream.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-10T15:01:20.000Z","updated_at":"2020-07-03T21:01:36.000Z","dependencies_parsed_at":"2023-06-08T03:15:15.546Z","dependency_job_id":null,"html_url":"https://github.com/Stiffstream/beast-cppcon2018-vs-restinio","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stiffstream%2Fbeast-cppcon2018-vs-restinio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stiffstream%2Fbeast-cppcon2018-vs-restinio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stiffstream%2Fbeast-cppcon2018-vs-restinio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stiffstream%2Fbeast-cppcon2018-vs-restinio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Stiffstream","download_url":"https://codeload.github.com/Stiffstream/beast-cppcon2018-vs-restinio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239583656,"owners_count":19663238,"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-11-07T13:31:16.174Z","updated_at":"2025-02-19T02:25:52.115Z","avatar_url":"https://github.com/Stiffstream.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What Is \"Beast-CppCon2018-vs-RESTinio\"?\n\nVinnie Falco, the main author of Boost.Beast, gives a talk on CppCon-2018: [Get Rich Quick! Using Boost.Beast WebSockets and Networking TS](https://cppcon2018.sched.com/event/FnJn/get-rich-quick-using-boostbeast-websockets-and-networking-ts). This talk is about modern C++, upcoming Networking TS and Boost.Beast library.\n\nA simple example was prepared by Vinnie Falco for that talk. Source code of that example can be found on [GitHub](https://github.com/vinniefalco/CppCon2018).\n\nDespite the fact that Boost.Beast is a great library and is bright example of C++ masterpiece, we think that usage of Boost.Beast for simple tasks is an overkill. Simple things must be done much simpler than approach proposed by Boost.Beast.\n\nTo prove our point of view we have created a reimplementation of Vinnie's example using OpenSource [RESTinio](https://stiffstream.com/en/products/restinio.html) library from [stiffstream](https://stiffstream.com). This repository contains the source code of our version of that simple application.\n\n# Some Notes To Readers\n\nWe do not have a goal to create a side-by-side comparison between Beast-based and RESTinio-based solutions. This comparison is left as an exercise for a reader :)\n\nSeriously speaking the best way to feel the difference is to study Beast-based solution and then compare it with RESTinio-based one. Look to the code. For example, look at [the most important part of main() function in Vinnie's code](https://github.com/vinniefalco/CppCon2018/blob/cfa005305bf4b4e42ea886a6afd989d057f69605/main.cpp#L40-L60). And then to [the same part in our code](https://github.com/Stiffstream/beast-cppcon2018-vs-restinio/blob/db8fa3fed81725cbe5a9c66040f7eb19fceb6494/dev/websocket_chat/main.cpp#L68-L221).\n\nYou can also take a look at request-processing code. In [Beast-based solution](https://github.com/vinniefalco/CppCon2018/blob/cfa005305bf4b4e42ea886a6afd989d057f69605/http_session.cpp#L83-L293). And then in [our solution](https://github.com/Stiffstream/beast-cppcon2018-vs-restinio/blob/db8fa3fed81725cbe5a9c66040f7eb19fceb6494/dev/websocket_chat/main.cpp#L234-L247).\n\n## What Do We Think?\n\nWe think that Boost.Beast is a great library. But it is too low-level.\n\nBecause of that we see only two niches appropriate for Boost.Beast:\n\n1. High-performant systems where you need a full control on everything. You can rely on Boost.Beast functionality and customization abilities to get maximum performance.\n2. More high-level and user-friendly libraries for working with HTTP in C++ code. Boost.Beast can be used as basis for that libraries. And you can hide Beast's complexity under your high-level API.\n\nBut if you need to solve more or less simple tasks outside of those niches it could be easier to use other C++ libraries like [RESTinio](https://stiffstream.com/en/products/restinio.html), [C++REST SDK](https://github.com/Microsoft/cpprestsdk), [RestBed](https://github.com/Corvusoft/restbed), [Pistache](https://github.com/oktal/pistache), [served](https://github.com/meltwater/served),  [CROW](https://github.com/ipkn/crow) and so on.\n\n# Obtaining And Building\n\n## Prerequisites\n\nA C++ compiler with C++14 support is required.\n\n## Obtaining Sources\n\nJust use `git clone` command to download example's sources.\n\n```sh\ngit clone https://github.com/Stiffstream/beast-cppcon2018-vs-restinio\n```\n\nYou can also download a tarball with example's sources from a [Releases](https://github.com/Stiffstream/beast-cppcon2018-vs-restinio/releases) section. That tarball already contains all necessary dependencies.\n\n## Building\n\nThere are three approaches for building Shrimp:\n\n* by using Docker;\n* by using CMake;\n* by using Mxx_ru.\n\nThe simplest one is Docker-build because all necessary dependencies are downloaded and built automatically during docker build command.\n\n### Docker build\n\nYou need [Docker](https://www.docker.com/) installed.\n\nEnter into example's folder and run docker build command:\n\n```sh\ncd beast-cppcon-2018-vs-restinio\ndocker build -t websocket_chat .\n```\n\nAll necessary dependencies will be downloaded, configured and built inside Docker's image.\n\nThen you can start Docker's image:\n\n```sh\ndocker run -p 8080:8080 websocket_chat\n```\n\n### Build with CMake\n\nCMake version 3.8.0 or above is required.\n\nThe full source code of the example with all necessary dependencies must be downloaded as tarball from [Releases](https://github.com/Stiffstream/beast-cppcon2018-vs-restinio/releases) section. Then (_XYZ_ is a precise version of tarball):\n\n```sh\ntar xaf beast-cppcon2018-vs-restinio-XYZ.tar.bz2\ncd beast-cppcon2018-vs-restinio/dev\nmkdir cmake_build\ncd cmake_build\ncmake -DCMAKE_INSTALL_PREFIX=target ..\ncmake --build . --config Release\ncmake --build . --config Release --target install\n```\n\n`websocket_chat_app` will be copied to `target/bin` subfolder.\n\n### Build with Mxx_ru\n\nTo build the example from repository you need to install Mxx_ru 1.6.14.5 or above:\n\n```sh\napt-get install ruby\ngem install Mxx_ru\n```\n\nMxx_ru helps to download necessary dependencies and used as a build tool.\n\nClone repo and download dependencies:\n\n```sh\ngit clone https://github.com/Stiffstream/beast-cppcon2018-vs-restinio\ncd beast-cppcon-2018-vs-restinio\nmxxruexternals\n```\n\nOnce you get example's sources and its dependencies you can build it.\n\n```sh\n# Start with repository root directory\ncd dev\n# Build.\nruby build.rb --mxx-cpp-release\n# See websocket_chat_app in 'target/release' directory.\n```\n\nOr you can download a tarball with all dependencies from from [Releases](https://github.com/Stiffstream/beast-cppcon2018-vs-restinio/releases) section. Then (_XYZ_ is a precise version of tarball):\n\n```{.sh}\ntar xaf beast-cppcon2018-vs-restinio-XYZ.tar.bz2\ncd beast-cppcon2018-vs-restinio/dev\nruby build.rb --mxx-cpp-release\n```\n`websocket_chat_app` will be in `target/release` subfolder.\n\n# License\n\nThe example is distributed under BSD-3-CLAUSE license.\n\nFor the license of RESTinio library see LICENSE file in RESTinio distributive.\n\nFor the license of asio library see COPYING file in asio distributive.\n\nFor the license of nodejs/http-parser library see LICENSE file in nodejs/http-parser distributive.\n\nFor the license of fmtlib see LICENSE file in fmtlib distributive.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstiffstream%2Fbeast-cppcon2018-vs-restinio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstiffstream%2Fbeast-cppcon2018-vs-restinio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstiffstream%2Fbeast-cppcon2018-vs-restinio/lists"}